Created
May 20, 2014 15:03
-
-
Save jaminguy/2ca497affc41c4150dc5 to your computer and use it in GitHub Desktop.
Load a view from a nib in almost one line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (instancetype)newInstance { | |
id newInstance = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] firstObject]; | |
return [newInstance isKindOfClass:[self class]] ? newInstance : nil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment