簡體   English   中英

如何使用UIPanGestureRecognizer的_firstScreenLocation?

[英]How to use _firstScreenLocation of UIPanGestureRecognizer?

嗨,我在視圖中使用捏縮放。
我想限制此縮放視圖的拖動距離。
因為可以將縮放的視圖拖動到屏幕的底部或任何其他邊緣,以使得僅背景可見並且實際視圖隱藏在后面,所以無法將視圖再次拖動到中心。
有一個名為_firstScreenLocation和_lastScreenLocation的變量可用於計算距離,但是這兩個變量都是不可訪問的,因為它們是在@package指令下聲明的。
請提出一些更聰明的方法。

要找到移動的距離,請捕獲開始事件和當前事件,然后進行數學計算:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM