我有一个应用程序,里面有一个UIViewController附在UIWindow上。在UIViewController视图中,我添加了一个按钮和一个大小为100x80的uiview_1。此uiview_1包含另一个uiview_2作为相同大小的子视图,该uiview_2在运行时包含一个UIImageView或UIlable ( UIImageView和UIlable都启用了userinteraction )。
现在,在UIImageView的触摸/单击上,我想使用presentModalViewController显示一个新的视图,问题是视图是显示的,并使用上一个/主屏幕上的导航栏上的后退按钮。这里的问题出现在图片中,现在我无法触摸按钮或UIImageView。两者都没有响应,但应用程序没有崩溃,也没有冻结。
这有什么不对吗?
请帮忙..。
-编辑
第一种方法:
SWVController *swvController = [[SWVController alloc] init];
UINavigationController *viewNavController = [[UINavigationController alloc] initWithRootViewController:swvController];
UIViewController *pushController = [[UIViewController alloc] init];
UIWindow *win = [[UIApplication sharedApplication] keyWindow];
[win addSubview:pushController.view];
[pushController presentModalViewController:viewNavController animated:YES];在swvController中,我有back按钮调用dismissModelViewController,点击>>,结果是主屏幕ctrls没有响应触摸桑迪3小时前。
第二种方法:
SWVController *swvController = [[SWVController alloc] init];
UINavigationController *viewNavController = [[UINavigationController alloc] initWithRootViewController:swvController];
UIViewController *pushController = [[UIViewController alloc] init];
[self addSubview:pushController.view];
[pushController presentModalViewController:viewNavController animated:YES];在swvController中,我有一个back按钮,它在单击dismissModelViewController时调用>>,结果是在导航栏上的swvController的back按钮没有响应- sandy在3小时前
第三种方法:
SWVController *swvController = [[SWVController alloc] init];
UINavigationController *viewNavController = [[UINavigationController alloc] initWithRootViewController:swvController];
SampleAppAppDelegate *appdel = [[UIApplication sharedApplication] delegate]; [appdel.viewController presentModalViewController:viewNavController animated:YES];的结果很好,但问题是我不想使用SampleAppAppDelegate,我想把我的小Uiview (100x80)作为一个ctrl给其他人,在那里我的ctrl将无法在运行时获得SampleAppAppDelegate应用程序的AppDelegate。-桑迪3小时前
发布于 2010-01-20 03:37:37
如果要显示模态视图控制器,请调用此方法:
- (IBAction)showInfo {
FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];
}将此方法添加到您自己中:
- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller {
[self dismissModalViewControllerAnimated:YES];
}使用工具栏或其他按钮,并将其连接到模态视图控制器中的此方法:
- (IBAction)done {
[self.delegate flipsideViewControllerDidFinish:self];
}所有代码都来自苹果。
发布于 2009-10-20 06:10:30
您是如何处理单击/触摸UIImageView的?结束了吗?
尝试放置一些日志(NSLog)并在调试模式下运行应用程序(放置一些断点)以查看控件是否到达您的操作方法.
另外,当你做presentModalViewController时,你不需要弹出导航条上的后退按钮.你只需要用dismissModelViewController来隐藏它。
https://stackoverflow.com/questions/1592709
复制相似问题