Xcode--uiscrollview and Agent Mode

Source: Internet
Author: User

First, Uiscrollview (1). Common Properties @property (nonatomic) Cgpoint contentoffset; //record the location of Uiscrollview scrolling@property (nonatomic) cgsize contentsize;//content size (range that can be scrolled)@property (nonatomic,assign)ID<UIScrollViewDelegate>Delegate;//Proxy Object@property (nonatomic) BOOL bounces;//does it have a spring effect ?@property (nonatomic) BOOL showshorizontalscrollindicator;//whether to display the horizontal scroll bar@property (nonatomic) BOOL showsverticalscrollindicator;//whether to show vertical scroll bars//Tip: Finish mastering contentsize, Contentoffset, delegate(2). Pinch gesture Zoom1. Scaling principle Detailed1>when the user attempts to scale Uiscrollview, ScrollView tries to send a message to its delegate (proxy object) asking which child control to indent2>In other words, ScrollView tries to call a method of delegate, asking which child control to scale, and the return value of the method is the child control that needs to be scaled2Summary of Scaling principles1>Uiscrollview Set Delegate object first2>Uiscrollview must know which method delegate returns the child controls that need to be scaled, and delegate must implement the method that returns the child control that needs to be scaled3>Uiscrollview to negotiate with the delegate object: Which method returns the child controls that need to be scaled?4>the way to return the child controls that need to be scaled is:-(UIView *) Viewforzoominginscrollview:3. Half of the scaling implementation steps (such as scaling Uiscrollview internal Uiimageview)1>set ScrollView's delegate to Controller (self)2> Controller complies with Uiscrollviewdelegate protocol <UIScrollViewDelegate>3> Controller implementation. (UIView *) Viewforzoominginscrollview: Method that returns the child controls that need to be scaled4>set maximum and minimum scaling two, agent design mode1, use occasions1>a want B to help do some things, let B become a agent2>a want to inform B something happened, or want to pass some data to B, let B become a agent3>B want to listen to some of the things a do, let B become a agent2, use steps1>Define an agreement2>B to comply with the agreement, to achieve the appropriate method3To define a proxy attribute in >aID< agreements >Delegate; 4> Create a B object, set the delegate property of A to B object

Xcode--uiscrollview and Agent Mode

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.