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

首頁 > 系統 > iOS > 正文

touchesBegan: withEvent: 不執行解決

2019-10-21 18:49:32
字體:
來源:轉載
供稿:網友

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 


注:相關教程知識閱讀請移步到IOS開發頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 思茅市| 满城县| 西吉县| 德保县| 聊城市| 岑巩县| 潜山县| 宁蒗| 皋兰县| 康平县| 柳州市| 大悟县| 平昌县| 皮山县| 冀州市| 永济市| 应用必备| 休宁县| 贵德县| 铜川市| 旬阳县| 休宁县| 陆丰市| 德清县| 故城县| 五台县| 安达市| 南雄市| 酒泉市| 福清市| 柳林县| 和田市| 福泉市| 永定县| 邯郸市| 陇川县| 朝阳市| 河南省| 东乡县| 垫江县| 会宁县|