我有一个带有全屏 UIImageView 的 ViewController。我已经隐藏了状态栏和导航栏,所以没有办法返回,只能点击某个地方。
所以我想用这个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];
}
我被困在那里,这个全屏图像,我不能回去。如何关闭视图控制器?