如何解决模态视图不起作用
| 我在视图控制器中使用以下代码,并且希望它提供另一个名为\“ chooserViewController \”模态的视图控制器 - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated
{
[self presentModalViewController:chooserViewController animated:YES];
}
我收到无法识别\“ chooserViewController \”的编译错误。我做错了吗?
更新:
- (void)add:(id)sender
{
RoutineExerciseChooserViewController *routineExerciseChooserViewController = [[RoutineExerciseChooserViewController alloc] initWithNibName:@\"RoutineExerciseChooserViewController\" bundle: nil];
[self presentModalViewController:routineExerciseChooserViewController animated:YES];
[routineExerciseChooserViewController release];
}
解决方法
您需要创建
chooserViewController
:
- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated {
ChooserViewController *chooserViewController = [[ChooserViewController alloc] initWithNibName:@\"ChooserView\" bundle: nil];
[self presentModalViewController:chooserViewController animated:YES];
[chooserViewController release];
}
如果您不是从笔尖加载,显然您会使用另一种方式来创建chooserViewController
,但是您必须做一些事情以确保它存在,然后才能显示出来。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。