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

在 UIScrollView 中使用 UITouch

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

問題描述

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

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

我已經(jīng)設(shè)置了一個(gè)處理大型 UIView 的 UIScrollView,在 UIView 內(nèi)部是一個(gè) UIImageView,我設(shè)法讓 UITouch 將 UIImageView 拖到 UIScrollView 之外,但在它內(nèi)部沒有注冊(cè)事件.

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 周圍拖動(dòng) UIImageView 而 UIScrollView 沿著圖像移動(dòng),如果用戶將其拖動(dòng)到 UIImageView 開始拖動(dòng)時(shí)的 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 事件,如果啟用滾動(dòng),則不會(huì)將它們傳播到其內(nèi)容.因此,為了在我的應(yīng)用程序中拖動(dòng) UIScrollView 內(nèi)容,我做了以下技巧:

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:檢查您是否觸摸了可拖動(dòng)"區(qū)域.如果是 - 禁用 UIScrollView 中的滾動(dòng).

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

touchesMoved:現(xiàn)在,當(dāng)滾動(dòng)被禁用時(shí),您的內(nèi)容視圖會(huì)收到此事件,您可以相應(yīng)地移動(dòng)可拖動(dòng)的 UIImageView.

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

touchesEnded:在 UIScrolliew 中重新啟用滾動(dòng).

touchesEnded: Reenable scrolling in UIScrolliew.

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

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).

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

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

相關(guān)文檔推薦

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 應(yīng)用程序開發(fā)中的導(dǎo)航欄上添加 10 多個(gè)按鈕?)
UIScrollView scrolling only with one finger(UIScrollView 只能用一根手指滾動(dòng))
UitextField resignFirstResponder does not work in scroll view(UitextField resignFirstResponder 在滾動(dòng)視圖中不起作用)
How to Stop a UIScrollView from Swallowing Touches(如何阻止 UIScrollView 吞下觸摸)
主站蜘蛛池模板: 亚洲精品一区二三区不卡 | 欧美 日本 国产 | 成人性视频免费网站 | 中文字幕在线观看www | 一区二区中文 | 精品国产一区二区在线 | 成人免费视频一区二区 | 中文字幕一区二区三区精彩视频 | 中文字幕一区二区三区四区 | 国产一级电影网 | 欧美一区二区三区大片 | 91精品在线播放 | 欧美电影免费观看 | av超碰| 麻豆一区二区三区精品视频 | 欧美中文字幕一区二区三区亚洲 | 欧美日韩国产精品一区二区 | 亚洲午夜电影 | 国产99热 | 九色在线视频 | 天堂素人约啪 | 亚洲成人免费电影 | www.免费看片.com | 最新免费视频 | 91精品国产乱码久久久久久久 | 精品在线视频播放 | 精品久久久久久久久久久 | 91精品一区二区三区久久久久 | 2019天天操| 国产精品亚洲精品 | 亚洲精品二区 | 久久久久久综合 | 九九热在线视频观看这里只有精品 | 久久1区| 国内久久精品 | 五月综合激情婷婷 | 中文字幕视频一区 | 亚洲福利网 | 在线免费激情视频 | 午夜精品一区二区三区在线观看 | 日日夜夜天天干 |