Skip to content

Instantly share code, notes, and snippets.

@maddiesch
Created December 16, 2013 21:17
Show Gist options
  • Save maddiesch/7994593 to your computer and use it in GitHub Desktop.
Save maddiesch/7994593 to your computer and use it in GitHub Desktop.
@interface View : UIView
@property (nonatomic, weak) UIView *mySubview;
@end
@implementation View
- (UIView *)mySubview {
if (!_mySubview) {
UIView *v = [[UIView alloc] initWithFrame:CGRectZero];
... some setup
_mySubview = v;
[self addSubview:v];
}
return _mySubview;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment