Summary of Uiscollview

Source: Internet
Author: User

In iOS development, it can be said that Uiscollview is the basis for all sliding class views, including Uitableview,uiwebview,uicollectionview and so on, and the Uiscrollview class provides support for displaying content larger than the application window. It allows the user to scroll with a swipe gesture and can use the expand/pinch gesture to zoom in and out of the content. The Uiscrollview class can have an agent that uses the Uiscrollviewdelegate protocol. For scaling work, the agent must implement Viewforzoominginscrollview: as well as ScrollViewDidEndZooming:withView:atScale:; In addition, the maximum (Maximumzoomscale) and minimum (Minimumzoomscale) scale must be different.

There are a lot of commonly used property settings and methods, and here is a unified record.

Property Automaticallyadjustsscrollviewinsets

When setting Uitextview or UITableView, there is always a blank space above or on the table because of navigation bar!!!

Any control that inherits Uiscrollview will be affected by this automaticallyadjustsscrollviewinsets property of Uiviewcontroller, by default Yes, when there is navigation bar, Uitextview's performance is the above blank, set as No,uitextview is normal.

If you use storyboard, you can also make changes in storyboard.

Alwaysbouncehorizontal

Boolean value that specifies whether to produce a "bounce" when scrolling to the end in the horizontal direction.

If the property and bounces are set to Yes, the horizontal drag is allowed even if the content is smaller than the scrolling view edge. The default value is No.

Alwaysbouncevertical

Boolean value that specifies whether to produce a "bounce" when scrolling to the end in a vertical direction.

If the property and bounces are set to Yes, the vertical drag is allowed even if the content is smaller than the scrolling view edge. The default value is No.

Bounces

A Boolean value that controls whether scrolling the view can go beyond the edge of the content and bounce back.

If the value of this property is yes. Scrolling views bounce When the content edges are encountered. If the value is no, the scroll stops immediately when the edge is reached and does not bounce. The default value is yes.

Bounceszoom

A Boolean value that specifies whether the scrolling view plays a content-scaled animation when scaling exceeds the maximum and minimum animation.

If the value of this property is yes, the scrolling view temporarily plays a slightly out-of-bounds animation and returns the limit size when scaling exceeds the maximum or minimum value. If this property is no, scaling stops immediately when the limit is reached and the default is yes.

Cancancelcontenttouches

A Boolean value that controls whether the touch content view always causes a trace.

If the value of this property is yes, the view in the content begins to track the touch's finger, and if the user drags the finger to a distance that is sufficient to scroll, the view receives touchescancelled:withevent: information, and the scrolling view handles the touch as a scrolling event. If the value of this property is no, scrolling view ignores finger movement and does not scroll when the content view starts tracking.

Contentinset

Represents the distance that the content view is embedded from the closed scrolling view.

Use this property to increase the scrolling area around the content. Units are points. The default value is Uiedgeinsetsszero.

Contentoffset

A point that represents the offset from the original point of the scrolling view to the origin of the content view.

The default value is Cgpointzero.

Contentsize

The size of the content view.

Units are points. The default value is Cgsizezero.

decelerating

Returns whether the content in the scrolling view continues to move after the finger is lifted. (Read only)

Returns YES if the user is no longer dragging content but scrolling is still occurring.

Decelerationrate

A floating-point number that specifies the rolling deceleration rate after the user has lifted the finger.

Your application can use the Uiscrollviewdecelerationratenormal and Uiscrollviewdecelerationratefast constants as reference points to obtain a reasonable deceleration rate.

Delayscontenttouches

A Boolean value that specifies whether scrolling views delay handling touch down gestures.

If the property value is yes, the scrolling view delays processing the down gesture until you can determine whether the intent of the operation is scrolling. If the value is no, the scrolling view immediately calls TouchesShoudBegin:withEvent:inContentView:. The default value is yes.

Detailed discussions are discussed in the class.

Delegate

Scrolls the View object's hosting.

Hosting must implement the Uiscrollviewdelegate protocol. The Uiscrollview class (not persisted) invokes each method in the managed implementation.

Directionallockenabled

Boolean value that specifies whether scrolling is prohibited in a certain direction.

If this property is no, scrolling is allowed in both horizontal and vertical directions. If this property is Yes, scrolling view disables scrolling in another direction when the user starts scrolling in one direction (horizontal or vertical). If you drag diagonally, scrolling is not locked and the user can drag in any direction before the drag is complete. The default value is No.

Dragging

A Boolean value that indicates whether the user started scrolling content.

The value held by this property may need to be scrolled for a period of time or distance before it is set to Yes.

Indicatorstyle

The style of the scrolling controller.

The default style is Uiscrollviewindicatorstyledefault. See "Scroll Indicator Style" For more descriptions of this constant.

Maximumzoomscale

A floating-point number that specifies the maximum scale factor that can be applied to scroll the view content.

This value specifies how large the content can be magnified. The default value is 1.0.

Minimumzoomscale

A floating-point number that specifies the minimum scale factor that can be applied to the scrolling view content.

This value specifies how small the content can be reduced to. The default value is 1.0.

Pagingenabled

A Boolean value that specifies whether scrolling views can be paged.

If the value is yes, scrolling view stops the integer multiples of the scrolling view border when the user scrolls. The default value is No.

Pangesturerecognizer

Gesture recognizer currently used for swipe gestures (read-only)

Your application can access this property when you want more precise control over the sliding gestures that are recognized by the scrolling view.

Pinchgesturerecognizer

Gesture recognizer currently used for expansion/contraction gestures (read only)

Your application can access this property when you want more precise control over the expansion/contraction gestures that are recognized by the scrolling view.

Scrollenabled

Boolean value that specifies whether scrolling is allowed.

If the value of this property is Yes, scrolling is allowed, and if no, scrolling is disabled. The default value is yes.

Scrolling view will no longer accept touch events when scrolling is disabled, and scrolling views will send events to the response chain.

Scrollindicatorinsets

Represents the distance that the scroll indicator is embedded from the closed scrolling view.

The default value is Uiedgeinsetsszero.

Scrolltotop

A Boolean value that controls whether the finger scrolling to the top is valid.

Scrolling to the top gesture is touching the status bar; When this property is yes, the scrolling view jumps to the status bar when this gesture occurs. This property defaults to Yes.

The gesture acts on a single visible scrolling view, if there are multiple scrolling views (for example, a date selector) Set this property, or if managed in Scrollviewshouldscrolltotop: Returns No,uiscrollview ignores the scrolling to the top of the request. After scrolling the view to the top of the content view, it sends a scrollviewdidscrolltotop: information to the host.

Showshorizontalscrollindicator

A Boolean value that controls whether the horizontal scroll indicator is visible.

The default value is yes. The indicator is displayed at the time of tracing and disappears after the trace.

Showsverticalscrollindicator

A Boolean value that controls whether the vertical scroll indicator is visible.

The default value is yes. The indicator is displayed at the time of tracing and disappears after the trace.

Tracking

Returns whether the user touches the content and initializes the scroll. (Read only)

The value of this property is yes when the user has touched the content view but can also start dragging.

Zoombouncing

A Boolean value that indicates that scaling has exceeded the zoom limit for the specified sink.

The value is yes if the scrolling view scale exceeds the maximum or minimum value, otherwise the value is no.

Zooming

A Boolean value that indicates whether the content view is currently indented.

If the user issues a zoom finger, the value is yes, otherwise no.

Zoomscale

A floating-point number that specifies the zoom factor that is currently applied to the content of the scrolling view.

This value specifies how much of the content is currently scaled. The default value is 1.0.

Method Flashscrollindicators

Briefly displays the scroll indicator.

You should call this method when you put the scrolling view in the front-end.

Scrollrecttovisible:animated:

Scrolls the specified area of content so that the content is visible in the receiver.

-(void) scrollRectToVisible: (CGRect) rectanimated: (BOOL) animated

Parameters:

Rect

A rectangle that defines the content view area.

Animated

If scrolling should be animated then pass in Yes, otherwise no.

This method scrolls the content view so that the areas defined in the RECT can be displayed exactly in the scrolling view. If the area is already visible, the method does nothing.

Setcontentoffset:animated:

Sets the offset of the content view Origin relative to the receiver Origin point.

-(void) Setcontentoffset: (Cgpoint) Contentoffset animated: (BOOL) animated

Parameters

Contentoffset

The offset point of the content view origin, expressed as a point.

Animated

If yes, moves to the new offset at a constant speed and the no moves immediately.

Setzoomscale:animated:

A floating-point number that specifies the current zoom factor.

-(void) Setzoomscale: (float) scale animated: (BOOL) animated

Parameters

Scale

The new value to which to scale the content.

Animated

If yes, the animation zooms to the newly scaled size, and no is scaled immediately.

The new scaling value should be between Minnumzoomscale and Maximumzoomscale.

Summary of Uiscollview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.