Skip to content

Instantly share code, notes, and snippets.

@hatfinch
Created November 22, 2011 10:46
Show Gist options
  • Save hatfinch/1385399 to your computer and use it in GitHub Desktop.
Save hatfinch/1385399 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)
{
myLandscapeView.alpha = 0.0;
if (myPortraitView)
myPortraitView.alpha = 1.0;
else
{
myPortraitView = [[UIView alloc] init];
[myScrubView addSubview:myPortraitView];
reload = YES;
}
myPortraitView.frame = myScrubView.bounds;
}
else
{
myPortraitView.alpha = 0.0;
if (myLandscapeView)
myLandscapeView.alpha = 1.0;
else
{
myLandscapeView = [[UIView alloc] init];
[myScrubView addSubview:myLandscapeView];
reload = YES;
}
myLandscapeView.frame = myScrubView.bounds;
}
if (reload)
[self reloadData];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment