开发者

what is diffrence in this code with mainbundle and without?

Hello i see this new code for me ,like this for push

tw *obj =[[tw alloc]initWithNibName:@"tw" bundle:[NSBundle mainBundle]];

normally i write code like this

tw *obj =开发者_开发问答[[tw alloc]initWithNibName:@"tw" bundle:nil];

what is difference in this bundle ?


there is no difference in this case.

passing nil to initWithNibName:bundle: has a special meaning. if the parameter is nil, it means the implementation should use [NSBundle mainBundle].


From docs:

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.

So there is no difference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜