久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何防止觸摸事件傳遞給 UIView 的超級視圖?

how to prevent a touch event passed to a UIView#39;s superview?(如何防止觸摸事件傳遞給 UIView 的超級視圖?)
本文介紹了如何防止觸摸事件傳遞給 UIView 的超級視圖?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習吧!

問題描述

我制作了一個程序,其中包含可以拖動以在屏幕上移動的圖片.我也使用了 UIScrollView,因為空間比窗口大.我將 UIView 子類化為圖片視圖,以在此類中顯示圖片并處理觸摸.圖片視圖作為子視圖添加到滾動視圖.但現(xiàn)在我有一個問題:當我拖動圖片時,scrollView 與圖片一起移動.我想知道是否有辦法消耗圖片類中的觸摸以防止它們傳遞給超級視圖.

I've made a program which contains pictures that can be dragged to move on the screen. also I used UIScrollView since the space is larger than the window. I subclassed UIView as a pictures view to display the picture and handle touches in this class. picture views are added as subviews to the scrollView. but now I have a problem: when I drag the picture, the scrollView moves together with the picture. I'm wondering if there is a way to consume the touches in the picture class to prevent them from passing to superview.

推薦答案

你應(yīng)該把你的代碼放在 UIView 的 "touchesMoved:withEvent:" 方法中.如果你的 View 會自己處理這個事件,那么它不應(yīng)該冒泡到 superview

You should to put your code in "touchesMoved:withEvent:" method of your UIView. If your View will handle this event by yourself, then it should not bubble to superview

這篇關(guān)于如何防止觸摸事件傳遞給 UIView 的超級視圖?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

how to set scrollview content size in swift 3.0(如何在 swift 3.0 中設(shè)置滾動視圖內(nèi)容大小)
Stop a UITableView from automatically scrolling(阻止 UITableView 自動滾動)
iOS UIScrollView Lazy Loading(iOS UIScrollView 延遲加載)
using iOS 6.0 SDK and building for iOS 5 Target causes UIScrollView setMinimumZoomScale to fail when running on iOS 5 simulator(在 iOS 5 模擬器上運行時,使用 iOS 6.0 SDK 并為 iOS 5 Target 構(gòu)建會導(dǎo)致 UIScrollView setMinimumZ
Create partial-screen UIPageViewController programmatically(以編程方式創(chuàng)建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
主站蜘蛛池模板: 欧美一级在线 | 日韩电影中文字幕在线观看 | www.99re| 亚洲免费av一区 | 中文字幕91 | 91传媒在线观看 | 日韩精品在线观看一区二区三区 | 亚洲乱码国产乱码精品精的特点 | 成人精品免费视频 | 日本久久综合网 | 国产一级一级国产 | 99久久婷婷 | 精品视频久久久久久 | 欧美 日韩 中文 | 日韩区| 国产精品亚洲精品 | 免费成年网站 | 一级国产精品一级国产精品片 | 亚洲视频二区 | 亚洲一区二区三区免费观看 | 中文字幕在线观看一区二区 | 日本三级线观看 视频 | 国产女人叫床高潮大片免费 | 亚洲精品乱码久久久久久9色 | 亚洲午夜视频 | 日韩欧美在线观看 | 日韩成人在线视频 | 中文字幕二区 | 99re6在线视频精品免费 | 99九九久久 | 中日韩欧美一级片 | 夜夜爽99久久国产综合精品女不卡 | 久久亚洲国产 | 国产精品久久久久久亚洲调教 | 欧美精品综合 | 国产情侣激情 | 99在线免费观看视频 | 九九热在线视频观看这里只有精品 | 超碰精品在线 | 黄色免费观看网站 | 国产福利观看 |