Skip to content

Instantly share code, notes, and snippets.

@charlesmchen
Last active December 22, 2015 14:59
Show Gist options
  • Select an option

  • Save charlesmchen/6489214 to your computer and use it in GitHub Desktop.

Select an option

Save charlesmchen/6489214 to your computer and use it in GitHub Desktop.
WeView *rootView = [[WeView alloc] init];
// Add background image.
UIImage *image = [UIImage imageNamed:@"Images/thun-stockhornkette-1904 1600.jpg"];
UIImageView *background = [[UIImageView alloc] initWithImage:image];
WeView *backgroundWrapper = [[WeView alloc] init];
[[backgroundWrapper addSubviewWithFillLayoutWAspectRatio:background]
setVAlign:V_ALIGN_TOP];
// The background will exceed the backgroundWrapper's bounds, so we need to clip.
backgroundWrapper.clipsToBounds = YES;
[demoModel.rootView addSubviewWithCustomLayout:[backgroundWrapper setStretches]];
// Add header with title and "tag" button.
WeView *headerView = [[WeView alloc] init];
headerView.backgroundColor = [UIColor colorWithWhite:0.5f alpha:0.5f];
headerView.opaque = NO;
[[headerView addSubviewWithCustomLayout:[DemoFactory createLabel:@"Ferdinand Hodler"
fontSize:20.f]]
setMargin:5];
[[[[headerView addSubviewWithCustomLayout:[DemoFactory buttonWithImageName:@"Glyphish_Icons/14-tag.png"]]
setHMargin:10]
setVMargin:5]
setHAlign:H_ALIGN_RIGHT];
[[rootView addSubviewWithCustomLayout:[headerView setHStretches]]
setVAlign:V_ALIGN_TOP];
// Add pillbox buttons to bottom of screen.
WeView *pillboxButtonsView = [[WeView alloc] init];
pillboxButtonsView.layer.cornerRadius = 5.f;
pillboxButtonsView.clipsToBounds = YES;
[pillboxButtonsView addSubviewsWithHorizontalLayout:@[
[self createFlatUIPillboxButton:@"Prev"],
[self createFlatUIPillboxSpacer],
[self createFlatUIPillboxButton:@"Details"],
[self createFlatUIPillboxSpacer],
[self createFlatUIPillboxButton:@"Next"],
]];
[[[demoModel.rootView addSubviewWithCustomLayout:pillboxButtonsView]
setBottomMargin:25]
setVAlign:V_ALIGN_BOTTOM];
// Add activity indicator.
UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[activityIndicatorView startAnimating];
[rootView addSubviewWithCustomLayout:activityIndicatorView];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment