国产探花免费观看_亚洲丰满少妇自慰呻吟_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 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 靖西县| 茶陵县| 莱阳市| 金平| 霍林郭勒市| 凤阳县| 略阳县| 永清县| 铜鼓县| 哈密市| 海宁市| 濮阳县| 田东县| 江北区| 大邑县| 普兰店市| 武冈市| 油尖旺区| 平利县| 遂川县| 定西市| 留坝县| 红桥区| 图木舒克市| 吉安市| 新竹市| 太原市| 内黄县| 许昌市| 阳谷县| 伊宁县| 武威市| 朝阳区| 洪江市| 崇礼县| 凌云县| 台安县| 永仁县| 河东区| 万全县| 万全县|