When and why to use initWithNibName:bundle: in development

一笑奈何 提交于 2019-12-12 02:19:31

问题


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

Why we use this method? Is it necessary when using xib file?


回答1:


Why we use init with nib ?

So we can take a view created with interface builder and initialize a view from that instead of coding everything yourself.

it is a good alternative to coding everything if you just need basic things.



来源:https://stackoverflow.com/questions/15633940/when-and-why-to-use-initwithnibnamebundle-in-development

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!