Skip to content

Instantly share code, notes, and snippets.

@charlesmchen
Last active December 27, 2015 08:19
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 charlesmchen/7295668 to your computer and use it in GitHub Desktop.
Save charlesmchen/7295668 to your computer and use it in GitHub Desktop.
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]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment