EurekaCommunity / ViewRow

ViewRow is a Eureka row that allows you to display any UIView (or UIView sunclass) within a Eureka row. Views can be created in code or loaded from nib files.
MIT License
77 stars 16 forks source link

How to display a UIImage in the entire row #2

Closed derekgould closed 6 years ago

derekgould commented 6 years ago

Can anyone suggest how to display a uiimage full-width and full-height in a viewrow cell?

alldritt commented 6 years ago

Sure, here's an example:

screenshot
import UIKit
import Eureka
import ViewRow

class ViewController: FormViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        form
            +++ Section("Section 1")

                <<< LabelRow() { (row) in
                    row.title = "Row Above"
                    row.value = "12345"
                }

                <<< ViewRow<UIImageView>()
                .cellSetup { (cell, row) in
                    //  Construct the view for the cell
                    cell.view = UIImageView()
                    cell.contentView.addSubview(cell.view!)

                    //  Get something to display
                    let image = UIImage(named: "trees")
                    cell.view!.image = image

                    //  Make the image view occupy the entire row:
                    cell.viewRightMargin = 0.0
                    cell.viewLeftMargin = 0.0
                    cell.viewTopMargin = 0.0
                    cell.viewBottomMargin = 0.0

                    //  Define the cell's height
                    cell.height = { return CGFloat(300) }
                }

                <<< LabelRow() { (row) in
                    row.title = "Row Below"
                    row.value = "12345"
                }

            +++ Section("Section 2")

                <<< LabelRow() { (row) in
                    row.title = "Label Row"
                    row.value = "12345"
                }
    }
}

Here's the example project: ViewRowTest.zip

fukemy commented 2 years ago

i got this error, can u help? Screen Shot 2021-11-24 at 20 20 41

alldritt commented 2 years ago

Do you have all the imports you need at the head of your file?

import UIKit
import Eureka
import ViewRow
alldritt commented 2 years ago

Were you able to resolve your problem?

fukemy commented 2 years ago

May be version of ViewRow conflict with Eureka, its work normally after using pod. Thank