Skip to content

Instantly share code, notes, and snippets.

@pilky
Forked from hatfinch/gist:1385399
Created November 22, 2011 12:36
Show Gist options
  • Save pilky/1385576 to your computer and use it in GitHub Desktop.
Save pilky/1385576 to your computer and use it in GitHub Desktop.
- (void)performLayout
{
[super performLayout];
myScrubView.frame = self.bounds;
BOOL reload = NO;
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait)
{
myPortraitView = [self _viewBySwitchingFromView:myLandscapeView toView:myPortraitView];
}
else
{
myLandscapeView = [self _viewBySwitchingFromView:myPortraitView toView:myLandscapeView];
}
if (reload)
[self reloadData];
}
- (NSView *)_viewBySwitchingFromView:(NSView *)aFromView toView:(NSView *)aToView {
aFromView.alpha = 0.0;
if (aToView) {
aToView.alpha = 1.0;
} else {
aToView = [[UIView alloc] init];
[myScrubView addSubview:aToView];
reload = YES;
}
aToView.frame = myScrubView.bounds;
return aToView;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment