我在呈现模态视图时遇到了一种奇怪的行为。我有一个滚动视图作为我的主视图有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];
}
什么会导致这种行为?
感谢。