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

在 UIScrollView 中使用 UITouch

Using UITouch inside a UIScrollView(在 UIScrollView 中使用 UITouch)
本文介紹了在 UIScrollView 中使用 UITouch的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

只是在玩 SDK,我想知道 UITouch 事件是否可以在 UIScrollView 中工作.

Just toying with the SDK and I was wondering if possible a UITouch event can work inside a UIScrollView.

我已經設置了一個處理大型 UIView 的 UIScrollView,在 UIView 內部是一個 UIImageView,我設法讓 UITouch 將 UIImageView 拖到 UIScrollView 之外,但在它內部沒有注冊事件.

I have setup a UIScrollView which handles a large UIView, inside the UIView is a UIImageView, I've managed to get the UITouch to drag the UIImageView outside of the UIScrollView but inside it's not registering the event.

我想我想要完成的是在大 UIView 周圍拖動 UIImageView 而 UIScrollView 沿著圖像移動,如果用戶將其拖動到 UIImageView 開始拖動時的 POS 之外,如果這有意義嗎?

I suppose what I was trying to accomplish was dragging the UIImageView around the large UIView whilst the UIScrollView moves along the image if the user drags it beyond the POS of when the UIView when the UIImageView began it's dragging, if that makes sense?

非常感謝

推薦答案

(如果我理解正確的話)

(If I understood the question correctly)

UIScrollView 攔截 touchMoved 事件,如果啟用滾動,則不會將它們傳播到其內容.因此,為了在我的應用程序中拖動 UIScrollView 內容,我做了以下技巧:

UIScrollView intercepts touchMoved events and does not propagate them to its contents if scrolling is enabled. So to do the dragging in the UIScrollView contents in my app I did the following trick:

touchesBegan:檢查您是否觸摸了可拖動"區域.如果是 - 禁用 UIScrollView 中的滾動.

touchesBegan: Check if you touch the "draggable" region. If YES - disable scrolling in UIScrollView.

touchesMoved:現在,當滾動被禁用時,您的內容視圖會收到此事件,您可以相應地移動可拖動的 UIImageView.

touchesMoved: Now as scrolling is disabled your contents view receives this event and you can move your draggable UIImageView accordingly.

touchesEnded:在 UIScrolliew 中重新啟用滾動.

touchesEnded: Reenable scrolling in UIScrolliew.

如果您想將視圖拖到可見的 UIScrollView 區域之外,您可能還需要手動檢查您是否靠近邊界并手動調整內容偏移量(我自己沒有嘗試過,但我認為它應該可以工作).

If you want to drag the view outside of the visible UIScrollView area you may also need to check manually if you're near the boundaries and manually adjust contents offset (I didn't try this myself but I think it should work).

這篇關于在 UIScrollView 中使用 UITouch的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

iOS UIScrollView Lazy Loading(iOS UIScrollView 延遲加載)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
How can i add more than 10 buttons on a navigationbar in iphone application development?(如何在 iphone 應用程序開發中的導航欄上添加 10 多個按鈕?)
UIScrollView scrolling only with one finger(UIScrollView 只能用一根手指滾動)
UitextField resignFirstResponder does not work in scroll view(UitextField resignFirstResponder 在滾動視圖中不起作用)
How to Stop a UIScrollView from Swallowing Touches(如何阻止 UIScrollView 吞下觸摸)
主站蜘蛛池模板: 国产精品一区二区三区在线播放 | 91亚洲精选 | 欧美亚洲一区二区三区 | 91资源在线观看 | 久久国产精品久久 | 最新中文字幕在线播放 | 免费黄色日本 | 毛片免费观看 | 国产一区 在线视频 | 精品欧美一区二区久久久伦 | 嫩草视频网 | 亚洲97 | 日韩国产在线观看 | 亚洲精品欧美 | 久青草影院 | 日韩综合在线 | 免费黄色的视频 | 亚洲欧美精品在线观看 | 特黄小视频 | 成人精品毛片 | 日日干夜夜操 | 午夜电影一区二区 | 成人欧美一区二区三区黑人孕妇 | 日韩精品一区二区三区在线播放 | 中文字幕亚洲精品 | 精品在线一区 | 成人午夜看片 | 日本久久精品 | 日日夜夜天天 | 日韩欧美在线免费观看视频 | 日韩欧美三级电影在线观看 | 在线精品一区二区三区 | 久久亚洲精品视频 | 亚洲一区二区中文字幕在线观看 | 日本不卡一区 | 国产亚洲欧美在线视频 | 不卡视频一区 | 九九热精品视频 | 最新免费视频 | 一区二区三区视频在线免费观看 | 精品国产乱码久久久久久蜜柚 |