xmartlabs / Eureka

Elegant iOS form builder in Swift
https://eurekacommunity.github.io
MIT License
11.77k stars 1.33k forks source link

I'm trying to change detailTextLabel layer #410

Closed gorbat-o closed 8 years ago

gorbat-o commented 8 years ago

Eureka (last) Xcode (last) iOS version (last)

Hi,

(sorry for bad english) I'm trying to resize the frame of detailTextLabel, and apply a cornerRadius on it. But it makes nothing.

i'have tried everything under this line ..


.cellSetup { cell, row in
                    cell.detailTextLabel?.textColor = UIColor.whiteColor()
                    cell.detailTextLabel?.layer.backgroundColor = UIColor.redColor().CGColor
                    cell.detailTextLabel?.inputView?.layer.cornerRadius = 20
                    cell.detailTextLabel?.inputView?.frame = CGRectMake(0, 0, 200, 200)
                    cell.detailTextLabel?.maskView?.layer.cornerRadius = 20
                    cell.detailTextLabel?.maskView?.frame = CGRectMake(0, 0, 200, 200)
                    cell.detailTextLabel?.inputAccessoryView?.layer.cornerRadius = 20
                    cell.detailTextLabel?.inputAccessoryView?.frame = CGRectMake(0, 0, 200, 200)
                    cell.detailTextLabel?.autoresizesSubviews = false
                    cell.detailTextLabel?.clipsToBounds = true
                    cell.detailTextLabel?.contentMode = .ScaleAspectFit
                    cell.detailTextLabel?.layer.cornerRadius = 20

                    cell.detailTextLabel?.frame.size.width = 200
                    cell.detailTextLabel?.layer.frame.size.width = 200

Thanks for futur help 👍

Cordially,

mtnbarreto commented 8 years ago

Do the same but using cellUpdate instead of cellSetup.

Example code:

                <<< ActionSheetRow<String>() {
                        ...
                    }
                    .cellUpdate({ (cell, row) in
                        cell.detailTextLabel?.layer.cornerRadius = 20
                        cell.detailTextLabel?.clipsToBounds = true
                        cell.detailTextLabel?.layer.backgroundColor = UIColor.greenColor().CGColor
                    })
gorbat-o commented 8 years ago

Hey,

Thanks for anwser, i just try that with

// Setting menuTitles
        for menuTitle in menuTitles {
            form.last! <<< LabelRow(menuTitle) {
                $0.title = $0.tag
                $0.value = "1"
                } .onCellSelection { cell, row in
                    debugPrint("Click on \(menuTitle)")
                } .cellSetup { cell, row in
                    print("cellSetup called")

                    cell.detailTextLabel?.textColor = UIColor.whiteColor()
                    cell.detailTextLabel?.layer.backgroundColor = UIColor.redColor().CGColor
                } .cellUpdate { cell, row in
                    print("cellUpdate called")

                    cell.detailTextLabel?.layer.cornerRadius = 20
                    cell.detailTextLabel?.clipsToBounds = true
            }
        }

and it's change nothing :/

mtnbarreto commented 8 years ago

Put all the code into cellUpdate as my example shows

gorbat-o commented 8 years ago

Thanks for fast answer I have already do it

// Setting menuTitles
        for menuTitle in menuTitles {
            form.last! <<< LabelRow(menuTitle) {
                $0.title = $0.tag
                $0.value = "1"
                } .onCellSelection { cell, row in
                    debugPrint("Click on \(menuTitle)")
                } .cellSetup { cell, row in
                    print("cellSetup called")
                } .cellUpdate { cell, row in
                    print("cellUpdate called")

                    cell.detailTextLabel?.textColor = UIColor.whiteColor()
                    cell.detailTextLabel?.layer.backgroundColor = UIColor.redColor().CGColor

                    cell.detailTextLabel?.layer.cornerRadius = 20
                    cell.detailTextLabel?.clipsToBounds = true
            }
        }

after that, it's change nothing :/

mtnbarreto commented 8 years ago

This is my code...

                <<< LabelRow() {
                    $0.title = "LabelRow"
                    $0.value = "1"
                } .onCellSelection { cell, row in
                } .cellSetup { cell, row in
                    print("cellSetup called")
                } .cellUpdate { cell, row in
                    print("cellUpdate called")

                    cell.detailTextLabel?.textColor = UIColor.whiteColor()
                    cell.detailTextLabel?.layer.backgroundColor = UIColor.redColor().CGColor

                    //cell.detailTextLabel?.layer.cornerRadius = 20
                    //cell.detailTextLabel?.clipsToBounds = true
                }

and this is the result...

screen shot 2016-05-09 at 9 01 32 pm

LabelRow cell is nothing else than a UITableViewCell so the flexibility to make customizations over it is limited by UIKit if exists. Eureka does not change any cell subview frame neither its constraints.

I will close the issue since this is not related directly with Eureka.

It's up to you to create a custom row adding the view that you need.

gorbat-o commented 8 years ago

Thanks 👍