Skip to content

Instantly share code, notes, and snippets.

@edopelawi
Last active September 26, 2015 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edopelawi/b05f38ea01257632d1a0 to your computer and use it in GitHub Desktop.
Save edopelawi/b05f38ea01257632d1a0 to your computer and use it in GitHub Desktop.
Added explicit dependencies for AddTopView and AddBottomView of SwappedViewAdditionViewDidLoad.m
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self reallyImportantMethod];
[self anotherImportantMethod];
[self addSubviews];
[self validateStaleData];
}
#pragma mark - Setups -
- (void)addSubviews
{
CGFloat viewWidth = self.view.frame.size.width;
CGFloat topViewYPosition = 64.0f;
CGFloat topViewHeight = 100.0f;
CGFloat bottomViewYPosition = topViewYPosition + topViewHeight;
CGFloat bottomViewHeight = 150.0f;
[self addBottomViewAtYPosition:bottomViewYPosition
withWidth:viewWidth
andHeight:bottomViewHeight];
[self addTopViewAtYPosition:topViewYPosition
withWidth:viewWidth
andHeight:topViewHeight];
}
- (void)addTopViewAtYPosition:(CGFloat)yPosition
withWidth:(CGFloat)topViewWidth
andHeight:(CGFloat)topViewHeight
{
CGRect topViewFrame = CGRectMake(0, yPosition, topViewWidth, topViewHeight);
UIView *topView = [[UIView alloc] initWithFrame:topViewFrame];
topView.backgroundColor = [UIColor redColor];
UILabel *title = [self titleLabelForTopViewWidth:topViewWidth
height:topViewHeight];
[topView addSubview:title];
[self.view addSubview:topView];
}
// rest of the code ...
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment