删除了 nib 问题并调用 init
我已经从 UIViewController 中删除了 nib 文件,现在我想让它调用 init 而不是 initWithNibName。然而,即使我删除了 UIViewController,它仍然在调用 initWithNibName。我需要做什么来更改它以便它调用 init ?
我通过代码初始化了 UIViewController 的其余部分,在我的 UITabBarController 中我有以下内容:
- (void)viewDidLoad
{
[self setTabURLs:[NSArray arrayWithObjects:@"tt://mygroup",
@"tt://all",
@"tt://search",
nil]];
}
I have deleted my nib file from my UIViewController and now I want to make it so that it calls init instead of initWithNibName. However, even after I deleted my UIViewController, it is still calling the initWithNibName. What do I need to do to change this so that it calls init?
I initialized the rest of the UIViewController via code, in my UITabBarController I have the following:
- (void)viewDidLoad
{
[self setTabURLs:[NSArray arrayWithObjects:@"tt://mygroup",
@"tt://all",
@"tt://search",
nil]];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Three20 框架始终调用 initWithNib,即使
TTViewController
是在没有 nib 文件的情况下创建的。只需根据需要将初始化代码移至
- (void)loadView
函数即可。Three20 framework always calls initWithNib, even if the
TTViewController
is created without a nib file.Just move your initialization code into the
- (void)loadView
function as you need to.为什么调用什么
init
方法对您来说很重要?只需将您要放入init
中的代码放入initWithNibName:bundle
中即可。Why does it matter to you what
init
method is called? Just take the code you would put ininit
and put it ininitWithNibName:bundle
.找到 UIViewController 被分配和初始化的位置,并将其更改为 init 而不是 initWithNib。
Find where UIViewController is being allocated and initialized and change it to init instead of initWithNib.