何时以及为何使用initWithNibName:bundle:在开发中 [英] When and why to use initWithNibName:bundle: in development

查看:87
本文介绍了何时以及为何使用initWithNibName:bundle:在开发中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

为什么我们使用这种方法?使用xib文件时是否有必要?

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

推荐答案

为什么我们将init与nib一起使用?

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.

这篇关于何时以及为何使用initWithNibName:bundle:在开发中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆