开发者

What is the name of draggable behavior on UIView iOS?

开发者 https://www.devze.com 2023-03-13 17:20 出处:网络
Most view in ios are开发者_如何转开发 draggable like in safari that I can drag and when I release it bounce back into it place. What does this behavior called any reference on this.You want to impleme

Most view in ios are开发者_如何转开发 draggable like in safari that I can drag and when I release it bounce back into it place. What does this behavior called any reference on this.


You want to implement UIScrollView.

The central notion of a UIScrollView object (or, simply, a scroll view) is that it is a view whose origin is adjustable over the content view. It clips the content to its frame, which generally (but not necessarily) coincides with that of the application’s main window. A scroll view tracks the movements of fingers and adjusts the origin accordingly. The view that is showing its content “through” the scroll view draws that portion of itself based on the new origin, which is pinned to an offset in the content view. The scroll view itself does no drawing except for displaying vertical and horizontal scroll indicators. The scroll view must know the size of the content view so it knows when to stop scrolling; by default, it “bounces” back when scrolling exceeds the bounds of the content.


Sounds like you're referring to functionality inherent in UIScrollView.


You are looking for UIScrollView, which bounces back into place when it is scrolled "too far".

Safari implements UIWebView which implements UIScrollView, which is why it scrolls.

0

精彩评论

暂无评论...
验证码 换一张
取 消