I am receiving the above warning in my code. I looked up the method in the documentation and found it was declared in UINibLoading.h
. I tried importing this, but the warning didn't disappear.
views:
47answers:
1
+3
A:
loadNibNamed:owner:options:
is an instance method, as indicated by the leading -
in the header file and in the documentation.
- (NSArray *)loadNibNamed:(NSString *)name owner:(id)owner options:(NSDictionary *)options
If this were
+ (NSArray *)loadNibNamed:(NSString *)name owner:(id)owner options:(NSDictionary *)options
that would have been a class method.
You need to first get the main bundle (i.e. the app bundle of the app you're developing) by the class method +mainBundle
, and then apply loadNibNamed:owner:options:
, as in
[[NSBundle mainBundle] loadNibNamed:@"foo" owner:self options:nil];
Yuji
2010-09-27 02:03:32
Thanks. So I didn't need to import that file at all
Casebash
2010-09-27 02:11:17
Casebash: Were you coming from Cocoa? AppKit's `+[NSBundle loadNibNamed:owner:]` *is* a class method, unlike its UIKit counterpart.
Peter Hosey
2010-09-27 07:54:52
I mainly do Cocoa (not Touch), and I didn't know `+[NSBundle loadNibNamed:owner:]` existed :p
Yuji
2010-09-27 15:06:35