Skip to content

Instantly share code, notes, and snippets.

@rbsgn
Created April 11, 2013 17:20
Show Gist options
  • Select an option

  • Save rbsgn/5365322 to your computer and use it in GitHub Desktop.

Select an option

Save rbsgn/5365322 to your computer and use it in GitHub Desktop.
+ (instancetype)viewFromXIB
{
UINib *nib = [UINib nibWithNibName:NSStringFromClass([self class]) bundle:[NSBundle bundleForClass:[self class]]];
NSArray *objects = [nib instantiateWithOwner:nil options:nil];
for (id obj in objects) {
if ([obj isKindOfClass:[self class]]) {
return obj;
}
}
NSAssert(NO, @"Can't load view from XIB");
return nil;
}
@beefon

beefon commented Apr 11, 2013

Copy link
Copy Markdown

А как это позволит избавиться от 2х классов с одинаковым именем?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment