UINavigationController不起作用(pushViewController忽略该视图)

| 关于
UINavigationController
有很多问题。我修改了代码以遵循Apple的示例,但是
pushViewController
方法不起作用:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

[window addSubview:navController.view];

[window makeKeyAndVisible];

LoginController *login = (LoginController*)[self.navController.viewControllers objectAtIndex:0];

if([login already_validated] == TRUE) {
    self.timeline = [[TimelineViewController alloc] initWithNibName:@\"Timeline\" bundle:[NSBundle mainBundle]];

    [navController pushViewController:timeline animated:YES];

    [self.timeline release];
}

return YES;     
该视图在以下行中已正确加载:
self.timeline = [[TimelineViewController alloc] initWithNibName:@\"Timeline\" bundle:[NSBundle mainBundle]];
...但
[navController pushViewController:timeline animated:YES];
没有呈现视图。我已经检查过,“ 5”不为空。 有任何想法吗? 最好! 卢卡斯 固定!! 问题出在ѭ6上。 不要在窗口类上设置ѭ7! 如果您在XIB文件上设置属性,则该视图将位于其他所有视图之上。     
已邀请:
        切勿直接向物业发送
release
!内存管理是通过setter方法完成的! 代替:
[self.someProperty release];
写:
self.someProperty = nil;
通常,您使用
dealloc
方法执行此操作。 在您的情况下,只需删除
[self.timeline release];
行或根本不使用任何属性。 编辑: 添加自动发布:
self.timeline = [[[TimelineViewController alloc] initWithNibName:@\"Timeline\" bundle:[NSBundle mainBundle]] autorelease];
    
        试试这个。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    


[window addSubview:navController.view];


[window makeKeyAndVisible];


LoginController *login = (LoginController*)[navController.viewControllers objectAtIndex:0];//here remove self


if([login already_validated] == TRUE) {

    self.timeline = [[TimelineViewController alloc] initWithNibName:@\"Timeline\" bundle:nil];//remove the nsbundle mainbundle


    [navController pushViewController:self.timeline animated:YES];//here u have to use with self.timeline

    [self.timeline release];

}

return YES;  
    

要回复问题请先登录注册