【问题标题】:iOS - View is not open (navigation controller app)iOS - 视图未打开(导航控制器应用程序)
【发布时间】:2011-03-30 10:48:25
【问题描述】:

我的应用程序有一个导航控制器,该应用程序工作正常,但在一个 UIView 中我有一个 UITableView。

当推送单元时,我需要打开新视图。我在 didSelectRowAtIndexPath 中试过这个:

NextViewController *nextView = [[NextViewController alloc] initWithNibName:@"NextViewController" bundle:nil];
[self.navigationController pushViewController:nextView animated:YES];
[nextView release];

但是视图没有打开。我也试过这个:

NextViewController *screen = [[NextViewController alloc]initWithNibName:@"nextView" bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:screen animated:YES];
[screen release];

现在视图已打开,但未正确定位,位于顶部导航栏和标签栏下方,并且视图中的一部分已隐藏。

如何正确打开视图?

编辑:

我将其他 UIButton 放在其他 UIView 中以打开其他辅助 UIView 并且不起作用。我完全糊涂了。

【问题讨论】:

    标签: iphone objective-c


    【解决方案1】:

    您需要重新设计您的视图以在作为模态视图呈现时正确显示

    【讨论】:

    • 我不想将其呈现为模态。我不明白为什么正确的方法行不通。
    • self.navigationController 的值是多少?
    【解决方案2】:

    使用这个来验证你的 nib 文件是否有 NextViewController 的名字

    NextViewController *nextView = [[NextViewController alloc] initWithNibName:@"NextViewController" bundle:nil];

    [self.navigationController pushViewController:NextViewController Animation:YES];

    [NextViewController 发布];

    【讨论】:

    • 我写这篇文章的时候错了。我只是编辑。程序按你说的设置,不工作。
    • 删除 NextViewController 笔尖,然后为该笔尖创建并赋予新名称。然后将新名称替换为 extViewController *nextView = [[NextViewController alloc] initWithNibName:@"urnewNamehere" bundle:nil];
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多