UIImageView 检测 touch 事件
2011-09-27
昨天,做了一个简单的需求.点击屏幕 navgation bar 隐藏. 结果发现 UIImageView 不接受 touchesBegan touchesMoved 事件. 没办法只能 需求神站 stackoverflow 相关参考[](http://stackoverflow.com/questions/855095/how-can-i-detect-the-touch- event-of-an-uiimageview "在此" ) 下面是我的实现:
self.view = imageView;
self.view.userInteractionEnabled = YES;
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
搞定!