可以通过滑动来关闭模态视图
在展示我的模态视图时,我遇到了奇怪的行为。我有一个滚动视图作为我的主视图,有 4 页...点击滚动视图上的按钮会显示模态视图,但我可以通过向左或向右滑动来关闭模态视图。显然我只是希望能够使用“完成”按钮来关闭。
这是我用来显示模态视图的方法:
- (void)popUpModal:(id)sender {
UIViewController *detailView = [[UIViewController alloc] initWithNibName:@"KeyboardView" bundle:nil];
detailView.view.backgroundColor = [UIColor blackColor];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:detailView];
UIBarButtonItem * doneButton =
[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self action:@selector(doneAction) ];
detailView.navigationItem.rightBarButtonItem = doneButton;
[doneButton release];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
NSString *url = @"http://www.google.com";
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
[detailView.view addSubview:webView];
[self presentModalViewController:navController animated:YES];
[detailView release];
[navController release];
}
什么会导致这种行为?
谢谢。
I have encountered a strange behaviour when presenting my modal view. I have a scroll view on as my main view with 4 pages... tapping on a button on the scroll view presents the modal view, but i can dismiss the modal view by swiping left or right. Obviously i just want to be able to dismiss using the Done button.
This is the method i use to display the modal view:
- (void)popUpModal:(id)sender {
UIViewController *detailView = [[UIViewController alloc] initWithNibName:@"KeyboardView" bundle:nil];
detailView.view.backgroundColor = [UIColor blackColor];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:detailView];
UIBarButtonItem * doneButton =
[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self action:@selector(doneAction) ];
detailView.navigationItem.rightBarButtonItem = doneButton;
[doneButton release];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
NSString *url = @"http://www.google.com";
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
[detailView.view addSubview:webView];
[self presentModalViewController:navController animated:YES];
[detailView release];
[navController release];
}
What would cause this behaviour?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论