ClassyKit / Classy

Expressive, flexible, and powerful stylesheets for UIView and friends.
http://classykit.github.io/Classy/
MIT License
740 stars 76 forks source link

problem with style not being correctly applied after dismissViewControllerAnimated:completion #80

Closed latteier closed 7 years ago

latteier commented 10 years ago

I'm having a problem with styles applied via properties not working when a view is re-displayed.

I define a default font for UILabels within a view controller and override this setting for the subjectLabel.

MyTableViewController {
  UILabel {
    font: $smaller
  }
  subjectLabel @{
    font: $larger
  }
}

This works fine. But when I present a view controller, and later dismiss it and return back to this view, the settings for the subjectLabel aren't used -- it uses the default UILabel settings.

If I change to using a cas_styleClass selector rather than a property selector everything works correctly.

Thanks for your help!

latteier commented 10 years ago

I'm experiencing another related issue.

UILabel {
  text-color: $Black
}

UINavigationBar {
  title-text-attributes: @{
    foreground-color: $White
  }
  bar-tint-color: $DarkerBlue
  tint-color: $White;
}

When I view a screen the navigation bar text is white. When I return to the screen after presenting another screen and then dismissing it and viewing the origin screen again, the navigation bar text uses the regular UILabel settings (text is black).

This seems related in that property selectors don't seem to being applied when a screen is viewed after returning to it via dismissing a view controller.

latteier commented 10 years ago

An update: the problem doesn't happen when popping view controllers (as I earlier claimed), instead it happens after dismissing modals via dismissViewControllerAnimated:completion.

Sorry for the inaccurate information earlier.

cloudkite commented 10 years ago

Sorry been busy with work! Does it help if you add the following to the view controller in question?

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self cas_updateStyling];
}
latteier commented 10 years ago

Thanks for the suggestion, unfortunately it doesn't solve the problem.

dnedrow commented 7 years ago

@latteier Did you ever resolve this? Did you try placing the call to cas_updateStyling in the completion block of dismissViewControllerAnimated?

dnedrow commented 7 years ago

@latteier , please close this issue if it no longer applies.

latteier commented 7 years ago

Probably best to close this. I haven't looked at this stuff in a long time.