-
-
Save dannygreg/1385518 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)performLayout | |
{ | |
[super performLayout]; | |
myScrubView.frame = self.bounds; | |
__block BOOL reload = NO; | |
UIView (^addSubView)(UIView *) = ^ (UIView *subview) { | |
subview.alpha = 0.0; | |
if (subview != nil) | |
subview.alpha = 1.0; | |
else | |
{ | |
subview = [[UIView alloc] init]; | |
[myScrubView addSubview:subview]; | |
reload = YES; | |
} | |
subview.frame = myScrubView.bounds; | |
return subview; | |
}; | |
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; | |
UIView *subView = addSubView(orientation == UIInterfaceOrientationPortrait ? myPortraitView : myLandscapeView); | |
if (orientation == UIInterfaceOrientationPortrait) { | |
myPortraitView = subView; | |
} else { | |
myLandscapeView = subView; | |
} | |
if (reload) | |
[self reloadData]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment