touchesBegan: withEvent: 不執(zhí)行解決
touchesBegan: withEvent: / touchesMoved: withEvent: / touchesEnded: withEvent: 等只能被UIView捕獲(如有問題請指出對請指出,路過的大牛請勿噴),當我們創(chuàng)建
UIScrollView 或 UIImageView 時,當點擊時UIScrollView 或 UIImageView 會截獲touch事件,導致touchesBegan: withEvent:/touchesMoved: withEvent:/touchesEnded: withEvent: 等方法不執(zhí)行。解決辦法:當UIScrollView 或 UIImageView 截獲touch事件后,讓其傳遞下去即可(就是傳遞給其父視圖UIView)
可以通過寫UIScrollView 或 UIImageView 的category 重寫touchesBegan: withEvent: / touchesMoved: withEvent: / touchesEnded: withEvent: 等來實現(xiàn)
// // 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內(nèi)存錯誤EXC_BAD_ACCESS的解決方法
- iOS開發(fā)中ViewController的頁面跳轉(zhuǎn)和彈出模態(tài)
- iOS毛玻璃效果的實現(xiàn)及圖片模糊效果的三種方法
- iOS開發(fā)中WebView的基本使用方法簡介
- IOS開發(fā)代碼分享之設置UISearchBar的背景顏色
- IOS獲取各種文件目錄路徑的方法
- iOS微信第三方登錄實現(xiàn)
- IOS開發(fā)代碼分享之用nstimer實現(xiàn)倒計時功能
- iOS開發(fā)之路--仿網(wǎng)易抽屜效果
- iOS中使用schema協(xié)議調(diào)用APP和使用iframe打開APP的例子
相關文章
解決Xcode 8構建版本iTunes Connect獲取不到應用程序狀態(tài)的辦法
這篇文章主要介紹了關于解決Xcode 8構建版本iTunes Connect獲取不到應用程序狀態(tài)的辦法,需要的朋友可以參考下2017-03-03淺談強大易用支持URL Rewrite的iOS路由庫FFRouter
FRouter 是 iOS 中一個強大且易用的 URL 路由庫,支持 URL Rewrite,基于匹配查找 URL,效率高。非常具有實用價值,需要的朋友可以參考下2018-10-10IOS開發(fā) 支持https請求以及ssl證書配置詳解
這篇文章主要介紹了IOS開發(fā) 支持https請求以及ssl證書配置詳解的相關資料,需要的朋友可以參考下2017-02-02