first, the use of Uiscrollview1> add what needs to be shown to Uiscrollview 2> set the Contentsize property of the Uiscrollview, telling Uiscrollview the size of all the content, that is, telling it the range of scrolling (how far to roll, where to roll to the end)second, Uiscrollview can not scroll, may be the following reasons1> not set contentsize2> scrollenabled = No3> did not receive touch events: userinteractionenabled = no4> Do not cancel the AutoLayout function (to ScrollView scrolling, you must cancel the AutoLayout) ...third, the delegate of UiscrollviewUiscrollview the delegate needs to be implemented is defined in the Uiscrollviewdelegate protocol, so in order to become Uiscrollview delegate, The Uiscrollviewdelegate protocol must be followed, and then the corresponding method in the protocol can be used to monitor the Uiscrollview scrolling process. 1 "There are 2 ways to set the controller to Uiscrollview delegate: A. Through the code (self is the Controller) self.scrollView.delegate = self; B. Uiscrollview Common Properties @property (nonatomic) Cgpoint Contentoffset via Storyboard (right-click Uiscrollview) 2;
This property is used to indicate where the Uiscrollview scrolls.
@property (nonatomic) cgsize contentsize;
This property is used to indicate the size of the Uiscrollview content, the scrolling range (how far to roll)
@property (nonatomic) uiedgeinsets contentinset;
This property is capable of adding additional scrolling areas for 4 weeks of Uiscrollview
@property (nonatomic) BOOL bounces;
Set Uiscrollview If spring effect is required
@property (nonatomic,getter=isscrollenabled) BOOL scrollenabled;
Sets whether Uiscrollview can scroll
@property (nonatomic) BOOL showshorizontalscrollindicator;
Whether to display the horizontal scroll bar
@property (nonatomic) BOOL showsverticalscrollindicator;
Whether to display vertical scroll bar 3 Uiscrollview zoom: When the user uses a pinch gesture on Uiscrollview, Uiscrollview sends a message to the agent asking the agent to scale which child control within itself (which piece of content) When the user uses a pinch gesture on Uiscrollview, Uiscrollview invokes the proxy's Viewforzoominginscrollview: method, which is the control that the method returns is the one that needs to be scaled. Set id<uiscrollviewdelegate> delegate proxy object for Uiscrollview
Set Minimumzoomscale: Minimum scale to zoom out
Set Maximumzoomscale: Maximum scale magnification
Let the proxy object implement the following method to return the view control that needs to be scaled
-(UIView *) Viewforzoominginscrollview: (Uiscrollview *) ScrollView;
Other proxy methods related to scaling
Call when Zoom is complete
-(void) scrollviewwillbeginzooming: (Uiscrollview *) ScrollView Withview: (UIView *) view
is being scaled when calling the
-(void) Scrollviewdidzoom: (Uiscrollview *) ScrollView
As long as the Pageenabled property of the Uiscrollview is set to Yes,uiscrollview will be split into separate pages, the contents can be paginated
Generally with uipagecontrol enhance the paging effect, Uipagecontrol commonly used properties as follows
How many pages are there?
@property (nonatomic) Nsinteger numberofpages;
The page number that is currently displayed
@property (nonatomic) Nsinteger currentpage;
Whether you need to hide the page number indicator when there is only one page
@property (nonatomic) BOOL hidesforsinglepage;
Color of other page number indicators
@property (Nonatomic,retain) Uicolor *pageindicatortintcolor;
Color of the current page number indicator
@property (Nonatomic,retain) Uicolor *currentpageindicatortintcolor;
Four, Nstimer called "Timer"
Function: Executes the specified task at a specified time, performing the specified task at intervals.
Calling the following method will open a timed task
+ (Nstimer *) Scheduledtimerwithtimeinterval: (nstimeinterval) TI target: (ID) atarget
Selector: (SEL) Aselector
UserInfo: (ID) userInfo
Repeats: (BOOL) Yesorno;
Every ti second, call a Atarget Aselector method, Yesorno determines whether to repeat the task
The timer can be stopped by the Invalidate method, and once the timer is stopped, the task cannot be performed again. You can only create a new timer to perform a new task.
-(void) invalidate;
2-ios-scrollview