Revisions
-
Danny Greg revised this gist
Nov 22, 2011 . 1 changed file with 44 additions and 25 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,32 +1,51 @@ // In the class continuation or private category { UIView *_portraitView; UIView *_landscapeView; } @property (nonatomic, readonly) UIView *portraitView; @property (nonatomic, readonly) UIView *landscapeView; - (UIView *)subViewForOritentation:(UIInterfaceOrientation)orientation; //In the main @implementation - (UIView *)subViewForOritentation:(UIInterfaceOrientation)orientation { return (orientation == UIInterfaceOrientationPortrait ? self.portraitView : self.landscapeView); } - (UIView *)portraitView { if (_portraitView == nil) { _portraitView = [[UIView alloc] init]; //Any setup could go here or a common method if it can be abstracted } return _portraitView; } - (UIView *)landscapeView { if (_landscapeView == nil) { _landscapeView = [[UIView alloc] init]; //Any setup could go here or a common method if it can be abstracted } return _landscapeView; } - (void)performLayout { [super performLayout]; myScrubView.frame = self.bounds; UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; UIView *subview = [self subViewForOritentation:orientation]; subview.alpha = 1.0; [[[myScrubView subviews] lastObject] removeFromSuperView]; [myScrubView addSubView:subview]; subview.frame = myScrubView.bounds; [self reloadData]; } -
Danny Greg revised this gist
Nov 22, 2011 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,6 +16,7 @@ - (void)performLayout reload = YES; } subview.frame = myScrubView.bounds; return subview; }; UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; -
Danny Greg revised this gist
Nov 22, 2011 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ - (void)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; @@ -19,7 +19,12 @@ - (void)performLayout }; UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; UIView *subView = addSubView(orientation == UIInterfaceOrientationPortrait ? myPortraitView : myLandscapeView); if (orientation == UIInterfaceOrientationPortrait) { myPortraitView = subView; } else { myLandscapeView = subView; } if (reload) [self reloadData]; -
Danny Greg revised this gist
Nov 22, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ - (void)performLayout [super performLayout]; myScrubView.frame = self.bounds; __block BOOL reload = NO; void (^addSubView)(UIView *) = ^ (UIView *subview) { subview.alpha = 0.0; -
Danny Greg revised this gist
Nov 22, 2011 . 1 changed file with 13 additions and 25 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,37 +1,25 @@ - (void)performLayout { [super performLayout]; myScrubView.frame = self.bounds; BOOL reload = NO; void (^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; }; UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; addSubView(orientation == UIInterfaceOrientationPortrait ? myPortraitView : myLandscapeView); if (reload) [self reloadData]; -
hatfinch created this gist
Nov 22, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ - (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]; }