国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

touchesBegan: withEvent: 不執行解決

2020-07-26 03:00:59
字體:
來源:轉載
供稿:網友

touchesBegan: withEvent: / touchesMoved: withEvent: / touchesEnded: withEvent: 等只能被UIView捕獲(如有問題請指出對請指出,路過的大牛請勿噴),當我們創建

UIScrollView UIImageView 時,當點擊時UIScrollView UIImageView 會截獲touch事件,導致touchesBegan: withEvent:/touchesMoved: withEvent:/touchesEnded: withEvent: 等方法不執行。解決辦法:當UIScrollView 或 UIImageView 截獲touch事件后,讓其傳遞下去即可(就是傳遞給其父視圖UIView)

可以通過寫UIScrollView 或 UIImageView 的category 重寫touchesBegan: withEvent: / touchesMoved: withEvent: / touchesEnded: withEvent: 等來實現

// // UIScrollView+UITouch.m //  // // Created by MLS on 15/11/20. // Copyright © 2015年 mls. All rights reserved. //  #import "UIScrollView+UITouch.h"  @implementation UIScrollView (UITouch)  - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {   // 選其一即可   [super touchesBegan:touches withEvent:event]; //  [[self nextResponder] touchesBegan:touches withEvent:event]; }  @end 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 金乡县| 东城区| 弥渡县| 宣化县| 山阴县| 韶山市| 温州市| 云龙县| 略阳县| 综艺| 积石山| 竹山县| 阳东县| 鸡泽县| 新营市| 电白县| 孟村| 岑溪市| 云和县| 巩留县| 祁门县| 台东县| 扎鲁特旗| 资阳市| 建宁县| 兰州市| 馆陶县| 万全县| 房产| 昌乐县| 板桥市| 行唐县| 镇雄县| 永福县| 仙桃市| 正蓝旗| 河东区| 扶余县| 卢氏县| 星子县| 茌平县|