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

Set tintColor of newly created cells according to formController's view #857

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tobihagemann
Copy link
Contributor

I'm using storyboards and cells created by XLForm always have the default (blue) tintColor even though the storyboard has a different global tintColor set. That's why I'm setting the tintColor of newly created cells to the tintColor of formController.view.

@mats-claassen
Copy link
Member

In your case, which is the tintColor of the tableView? Have you tried setting that?

@tobihagemann
Copy link
Contributor Author

tobihagemann commented Aug 30, 2016

I had to debug this, but formController.view isn't the same as formController.tableView in my case. But it wouldn't have mattered, because the tintColor of both view and tableView are correctly set.

So yes, I've been already setting tableView.tintColor (I'm setting it in the viewDidLoad method of my XLFormViewController subclass). Interestingly, if I update the cell in viewDidAppear: by calling updateFormRow:, the cell's tintColor is correctly set. Doesn't work in viewWillAppear: though. But viewDidAppear is too late anyway and the color change is very janky, that's why I came up with this solution.

How would you set the color of the buttons in the OthersFormViewController of XLForm's Examples project? I'm kind of clueless on how it's intended to work. I've got a weird solution though for this particular example. With my commit, I can set e.g. self.view.tintColor = [UIColor redColor]; before(!) [super viewDidLoad];. But I guess you have something different in mind for this to work? 😄

@mats-claassen
Copy link
Member

I tried with OthersFormViewController by setting tableView.tintColor in viewDidLoad and calling initializeForm after that. I do not think initializeForm has to go in the init methods. This way the tintColor switches to what you want. However, the textLabels colors are still black as this color gets set in the update method. So for the buttons to adopt the tintColor you would have to set that manually.

@tobihagemann
Copy link
Contributor Author

tobihagemann commented Aug 31, 2016

It's not convenient to set the tintColor on the cells manually, because I don't want to set any properties on the cells themselves. I just want to interact with the rowDescriptor, which is kind of the whole point of XLForm.

Either remove XLFormButtonCell.m#L55-L59, because it doesn't make sense to set textLabel.textColor if the tintColor is always "wrong" (or just the default). Or my solution would be one possible workaround, at least that's what I'm going with for now in my project.

I really have no idea what the ideal solution would be for XLForm, but I believe there needs to be some sort of fix. 😁

@mats-claassen
Copy link
Member

I think those lines make that button cells with a simple action set their textColor to the tintColor. That works perfect if the tintColor of the tableView is set correctly. What I am not sure about is why this is just done when it is a "simpleAction"...
Note that in OthersFormViewController both buttons with a 'simple action' override the textColor of the textLabel so that you would have to delete those lines in the OthersFormViewController.

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

Successfully merging this pull request may close these issues.

None yet

2 participants