tolo / InterfaCSS

The CSS-inspired styling and layout framework for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS8+ orientation issues

tbrannam opened this issue · comments

in the current SimpleSample example, the implementation used the methods

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;

both of these are marked as deprecated in iOS8. InterfaCSS seems to depend on a trigger to restyle the views after rotation occurs (example shows the call being made in didRotateFromInterfaceOrienation)

Is there a suggested pattern to follow to ensure that styles are kept up to date in iOS8 or higher targets?

This appears to be a workable solution

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator {
    [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
        [[InterfaCSS interfaCSS] applyStyling:self.view includeSubViews:YES force:YES];
    } completion:NULL];

    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}

The rotation methods are actually only used for logging of active style declaration in the sample code - InterfaCSS itself actually doesn't depend on those rotation methods. An update of the sample code is underway.

So I may have a bug in my code, but when I comment out the 'rotation' call in my viewcontroller - I can end up with styles that get mixed up if they are in portrait or landscape ( I styled a background color of a label in a collectionviewcell as red when in landscape). I thought this was a required call - since it fixed me in the short term.