【发布时间】:2011-10-29 20:23:49
【问题描述】:
我有一个带有全屏 UIImageView 的 ViewController。我已经隐藏了 statusBar 和 NavigationBar,所以没有办法返回,只能点击某处。
所以我想用这个 touchesBegan 回去
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self dismissModalViewControllerAnimated:YES];
}
我也试过用这种方式
-(void)viewDidLoad
{
[super viewDidLoad];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
[self.navigationController setNavigationBarHidden:YES];
UITapGestureRecognizer *tapRecognizer;
tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissModalViewControllerAnimated:)];
[imageFrame addGestureRecognizer:tapRecognizer];
imageFrame.image = [UIImage imageWithContentsOfFile:image];
[tapRecognizer release];
}
我被这个全屏图像卡住了,我无法返回。 如何关闭视图控制器?
【问题讨论】:
-
关于什么的一些想法?你还没有告诉我们问题是什么。也许touchesBegan没有被调用?您在寻找最佳实践吗?
-
嗯......没有任何作用。我的意思是,我被这个全屏图像卡在那里,我不能回去。我会编辑我的问题,抱歉。
标签: iphone objective-c xcode uiimageview touchesbegan