Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What the meaning of [NSBundle mainBundle] in iPhone?

Tags:

iphone

bundle

RootViewController *rvController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]];

sometimes i see it use nil ,i dont know what exactly it use for?

like image 945
RAGOpoR Avatar asked Dec 15 '25 20:12

RAGOpoR


1 Answers

Here is the exact explanation for that:

The bundle in which to search for the nib file. This method looks for the nib file in the bundle's language-specific project directories first, followed by the Resources directory. If nil, this method looks for the nib file in the main bundle.

I think [NSBundle mainBundle] doesn't do anything different than you put nil. However, if you want to do internationalization and localization, you can use them

More details here

like image 158
vodkhang Avatar answered Dec 19 '25 08:12

vodkhang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!