Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnCellUnHighlight never called #129

Closed
vshahpledge opened this issue Dec 9, 2015 · 2 comments
Closed

OnCellUnHighlight never called #129

vshahpledge opened this issue Dec 9, 2015 · 2 comments

Comments

@vshahpledge
Copy link

I have the following:

        <<< DecimalRow() {
            //set current value and placeholder
            $0.title = "Weight"
            $0.placeholder = "Pounds"
            let weight: String? = Member.currentMemberInContext(nil)?.weight
            if let uWeight = weight {
                $0.value = Float(uWeight)
            }
            }.onCellUnHighlight({ (cell, row) -> () in
                //save value to server
            })

But the onCellUnHighlight callback is never called when the decimal row resigns first responder.

The onChange callback works alright, but I'd rather not make a network call every time a character is changed.

@mats-claassen
Copy link
Member

Hi, this is because currently the onCellHighlight overrides the onCellUnHighlight. Look at how the DecimalRow is defined. In fact most of the rows are defined like this.

public final class DecimalRow: _DecimalRow, RowType {
    required public init(tag: String?) {
        super.init(tag: tag)
        onCellHighlight { cell, row  in
            let color = cell.textLabel?.textColor
            row.onCellUnHighlight { cell, _ in
                cell.textLabel?.textColor = color
            }
            cell.textLabel?.textColor = cell.tintColor
        }
    }
}

So if you want to use the 'unhighlight' callback you must override the onCellHighlight as well.

@mtnbarreto
Copy link
Member

Same as #96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants