0

我收到此警告,但不知道我做错了什么,这是一个简单的代码,可以通过转换更改视图。我以前在 Xcode 3.x 中没有出现此错误,但现在在 4.x 中问题开始了。尽管这只是一个警告并且代码可以完美编译,但我想知道问题出在哪里。

-(IBAction)swapViews:(id)sender{
DemoViewController *view3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
view3.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:view3 animated:YES];}

感谢您的所有帮助

4

2 回答 2

1
 //DemoViewController*   ThirdViewController*   ????
 //the warning is in this line 
DemoViewController *view3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
view3.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:view3 animated:YES];

我想你想在这里做的是。

ThirdViewController *view3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
于 2012-08-15T09:51:18.220 回答
0

你忘了花括号吗?

-(IBAction)swapViews:(id)sender {
    DemoViewController *view3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
    view3.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:view3 animated:YES];
}
于 2012-08-15T09:52:01.537 回答