您的位置:首页 > 其它

利用TouchesBegan解决页面内 触摸 某个视图以外的处理的情况

2016-03-26 15:30 225 查看
-(void)touchesBegan:(NSSet )touches withEvent:(UIEvent )event

{

//宣告一个UITouch的指标来存放事件触发时所撷取到的状态

UITouch *touch = [[event allTouches] anyObject];

CGFloat ly = [touch locationInView: self.remarkTextView].y;

if ( ly < 0 || ly > viewHeight(self.remarkTextView) ) { //点标题栏也会消失,点其他地方捕捉不到了

[self.remarkTextView resignFirstResponder];
}

[super touchesBegan:touches withEvent:event];


}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: