Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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