0

我正在为 iphone 开发一个 vin 代码扫描器应用程序。一切都很顺利,但是当我尝试打开一个笔尖时,它会显示在我的另一个笔尖文件上。这是我启动新 nib 文件的按钮的代码。

-(IBAction)dOne{
    SellAutoViewController *autoController = [[SellAutoViewController alloc] initWithNibName: @"SellAutoViewController" bundle: nil];
    [self.view addSubview:autoController.view];
}

这是我在 SellAutoViewController.mi 中所做的,使用 shoulautorotate 函数以纵向模式显示它,但什么也没发生

-(BOOL)shouldAutorotate{
    return YES;
}
-(NSUInteger)supportedInterfaceOrientations{
    return (UIInterfaceOrientationMaskPortrait);
}

这是点击完成按钮之前的视图,它将加载 SellAutoViewController https://www.dropbox.com/s/8ssi4n50dcaqf28/Screenshot%202013.05.06%2013.26.54.png ,这是我点击完成按钮时发生的情况。:( https://www.dropbox.com/s/q6z6a4dr0n198n3/Screenshot%202013.05.06%2013.27.13.png

4

3 回答 3

1

You could use modalTransition here using this code

-(IBAction)dOne{
    SellAutoViewController *autoViewController= [[SellAutoViewController alloc] initWithNibName: @"SellAutoViewController" bundle: nil];
    autoViewController.modalTransitionStyle = UIModalTransitionStyleCrossDisolve;
    [self presentViewController:autoViewController animated:YES completion:nil];
}
于 2013-05-06T09:27:06.907 回答
1

用以下方法替换您的 dOne 方法

-(IBAction)dOne{
    SellAutoViewController *autoController = [[SellAutoViewController alloc] initWithNibName: @"SellAutoViewController" bundle: nil];
    [self presentViewController:controller animated:YES completion:nil];
}
于 2013-05-06T09:20:00.107 回答
0

您是否先设置了 UINavigationController?如果是,您应该尝试:

-(IBAction)dOne{
    SellAutoViewController *autoController = [[SellAutoViewController alloc] initWithNibName: @"SellAutoViewController" bundle: nil];
    [self.navigationController pushViewController:autoController animated:YES];
}
于 2013-05-06T08:47:08.330 回答