Uiview uiscrollview properties and classes


Property description
@Property (nonatomic) cgrect frame; the position and size of the control. All controls must specify this property, otherwise they cannot be displayed even if there are controls
@Property (nonatomic) cgrect bounds; the current control position and size, but different from frame, its position is determined (0,0)
@Property (nonatomic) cgpoint center; the center position of the control, where the general user locates the control
@Property (nonatomic) cgaffinetransform transform; control matrix changes, including translation, zooming and rotation; the default is cgaffinetransformidentity
@Property (nonatomic) uiviewautoresizing autoresizing mask; when the control is rotated, the size will automatically scale, and the default is uiviewautoresizing none
@Property (nonatomic, readonly) uiview * supervisor; the parent control of the current control
@Property (nonatomic, readonly, copy) nsarray * subviews; all the first level child controls of the current control, note that the child controls of the child controls are not included
@Property (nonatomic, getter = ishidden) bool hidden; whether to hide or not, default to No
@Property (nonatomic) uiviewcontentmode contentmode; content mode is mainly used to specify how to fill the content of the control (note that it is not a child control). Generally, uiimageview is often used, and the default is uiviewcontentmodescaletofill
@Property (nonatomic) nsinteger tag; the label of the control, which can store some information related to the current control (but note that it can only be reshaped), and the default value is 0
Method statement

  • (void) addsubview: (uiview *) view; add child control

  • (void) removefromsuperview; removes the current control from the parent control

  • (void) insertsubview: (uiview *) view atindex: (nsinteger) index; inserts a child control in the specified position

  • (void)beginAnimations:(NSString )animationID context:(void )Start an animation

  • (void) commitanimations; end an animation. Note that if some properties of the control change between the beginning and the end, IOS will change in an animated way

  • (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations NS_ AVAILABLE_ IOS(4_ Execute an animation in the form of a block. Note that there are several related methods for this method

  • (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer NS_ AVAILABLE_ IOS(3_ 2) ; add gesture operation

  • (void)removeGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer NS_ AVAILABLE_ IOS(3_ 2) ; remove gesture action
    Note that all of the above location properties are relative to the parent control (not the screen).

Property description
@Property (nonatomic) cgpoint contentoffset; content offset, the X, y distance of the vertex of the currently displayed content relative to the vertex of this control, which is cgpointzero by default
@Property (nonatomic) cgsize contentsize; the content size of the control is not necessarily in the display area. If this property is not set, the control cannot scroll, and the default is cgsizezero
@Property (nonatomic) uiedgeinsets contentinset; the margin around the control is similar to margin in CSS. Note that the margin is not a part of its content, and the default is uiedgeinsets zero
@Property (nonatomic, assign) id delegate; control agent is generally used for event monitoring. In IOS, most controls monitor events through agents
@Property (nonatomic) bool bounds; whether to enable the spring effect. After enabling the spring effect, drag to the edge to see the background behind the content. The default is yes
@Property (nonatomic, getter = ispagingenabled) bool paginenabled: whether to paginate or not. If pagination occurs, the moving width is an integral multiple of the screen width each time you drag left and right. The default value is No
@Property (nonatomic, getter = isscrollenabled) bool scrollenabled; whether to enable scrolling is yes by default
@Property (nonatomic) bool showshorizontalscrollindicator; whether to display the horizontal scroll bar; yes by default
@Property (nonatomic) bool showsverticalscrollindicator; whether to display the vertical scroll bar; yes by default
@Property (nonatomic) cgfloat minimumzoomscale; the minimum zoom is 1.0 by default
@Property (nonatomic) cgfloat maximum zoomscale; maximum zoomscale (note that only maximum zoomscale is greater than minimum zoomscale can zooming be possible), the default is 1.0
@Property (nonatomic, readonly, getter = istracking) bool tracking; (status) whether it is being tracked or not; yes when the finger is pressed down and has not been dragged; no in other cases
@Property (nonatomic, readonly, getter = isdragging) bool dragging; is it being dragged
@Property (nonatomic, readonly, getter = is decelerating) bool decelerating; is decelerating
@Property (nonatomic, readonly, getter = iszooming) bool zooming; is zooming
Method statement

  • (void) setcontentoffset: (cgpoint) contentoffset Animated: (bool) animated; sets the scroll position, and the second parameter indicates whether the animation effect is enabled

  • (void) scrollrecttovisible: (cgrect) rect Animated: (bool) animated; scrolls and displays the contents of the specified area. The second parameter indicates whether the animation effect is enabled
    Proxy method statement

  • (void) scrollviewdidscroll: (uiscrollview *) Scrollview; scrollevent method, which will be executed in a loop during scrolling (scrolling…)

  • (void) scrollviewwillbegindragging: (uiscrollview *) Scrollview; start dragging event method

  • (void) scrollviewdidenddragging: (uiscrollview *) Scrollview willdecelerate: (bool) decelerate; drag operation completion event method

  • (void) Scrollview will begin decelerating: (uiscrollview *) Scrollview; about to stop scrolling event method

  • (void) scrollviewdidenddecelerating: (uiscrollview *) Scrollview; scrollstop event method (executed after decelerating and stopping during scrolling)

  • (void)scrollViewWillBeginZooming:(UIScrollView )scrollView withView:(UIView )view NS_ AVAILABLE_ IOS(3_ 2) ; start scaling event method

  • (void)scrollViewDidZoom:(UIScrollView *)scrollView NS_ AVAILABLE_ IOS(3_ 2) ; zoom operation completion event method

  • (UIView )viewForZoomingInScrollView:(UIScrollView )Scrollview; returns the zoomed view. Note that only by implementing this proxy method can you zoom. This method returns the view to be zoomed