我收到了这个警告,但不知道我做错了什么,这是一个用转换来改变视图的简单代码。我没有使用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];}
感谢您的所有帮助
答案 0 :(得分: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];
答案 1 :(得分:0)
你忘了花括号吗?
-(IBAction)swapViews:(id)sender {
DemoViewController *view3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
view3.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:view3 animated:YES];
}