点击按钮,从页面A跳转到页面B。 
- (IBAction)loginButton:(id)sender {
        UIViewController *bview =[[UIViewController alloc] init];
        [self presentModalViewController : bview animated:YES];
    }出现了黑屏,这个是什么情况,哪里出错了,还是就是如何使用navgationbar 的push 详细点的,感谢。

解决方案 »

  1.   

    UIViewController *bview =[[[UIViewController alloc] init]autorelease];
    [self presentModalViewController : bview animated:YES];
    要进行内存释放,你这些当然奔溃了哦,bview加上autorelease
      

  2.   

    如果你用了ARC
    那么 UIViewController *bview =[[UIViewController alloc] init];
    bview在函数结束后就释放了,所以你需要在.h中声明,这样bview的生命周期就跟随调用对象的生命周期
      

  3.   

    UIViewController 应该是这个页面的问题,你别用这种方法打开,在程序启动的时候就显示UIViewController看看还会不会黑屏。AppDelegate.m 里
    UIViewController *appStartController = [[UIViewController alloc] init];
    self.window.rootViewController = appStartController;
      

  4.   

    打扰喽,楼上的各位。
    ◆如果不在虚拟机下运行什么iOS,就是在裸机上(或者多系统)安装iOS该如何实现?
    ◆在Windows下通过VMWare安装的话,不能解决的问题,帮忙看看啊
      

  5.   


    声明。。声明就是在.h文件里写 UIViewController bview;
      

  6.   

    .hinterface xxxController {
      UIViewController *anotherView;
    }
      

  7.   

    释放不释放 是内存的问题。但是楼主说黑屏而不是挂掉,那就应该不是内存的问题,而且也没有必要设置成全局的变量,楼主试试将bview的backgroundColor改掉再试试是不是还是黑屏。
      

  8.   

    bview 刚初始化,都没值、、肯定打不开的
    UIViewController *view = [[NSClassFromString(viewcontroller) alloc]initWithNibName:viewController budle:nil];
      

  9.   

    在a面上加b视图
    - (IBAction)loginButton:(id)sender {
            UIViewController *bview =[[UIViewController alloc] initWithNibName:nil bundle:nil];
            [self presentModalViewController : bview animated:YES];
    [bview release];
        }从a面推到b视图
    - (IBAction)loginButton:(id)sender {
            UIViewController *bview =[[UIViewController alloc] initWithNibName:nil bundle:nil];
            [self.navigationController bview animated:YES];
    [bview release];
        }前提是保证b视图上存在子视图
      

  10.   

    UIViewController *view = [[NSClassFromString(viewcontroller) alloc]initWithNibName:viewController budle:nil]; 
      

  11.   

    UIViewController *vc = [[UIViewController alloc]init];//普通跳转
    self.view.window.rootViewController = vc;
    [vc release];//导航push
    [self.navigationController pushViewController:vc animated:YES];
    [vc releas];//模态淡出
    [self presentViewController:vc animated:YES completion:nil];
    [vc release];
      

  12.   

    presentModalViewController 这个方法已经过时了吧。