ScrollView properties, and Agent method summary

Source: Internet
Author: User

This article wants to provide some help to those UI beginners.

I think: Learning ScrollView, may be used in later work is not too much, but it's two sub-categories, I believe the proportion is absolutely great, uitableview and Uicollectionview. As we all know, OC is an object-oriented, high-level language based on C language encapsulation. Object-oriented three major features: encapsulation, inheritance, polymorphism. When it comes to inheritance, subclasses can inherit not only the attributes and methods of the parent class, but also their proxies, so the proxy method of ScrollView, and the settings of each property, can be used in UITableView and Uicollectionview, and people who read the blog can try it out.

To learn any of the controls, you can click into this control to see the contents of its uikit, so that it has all the properties, methods, and proxy methods that you can find. This way can save you a lot of time, you do not need to rote some things, just need to go in to find it.

Talk less, let's take a look at the usage of ScrollView.

  viewcontroller.h//  scrollview01////  Created by Mac on 15-7-14.//  Copyright (c) 2015 Mac. All rights reserved.//#import <uikit/uikit.h>//in the. h file, sign the Uiscrollview proxy method @interface Viewcontroller: Uiviewcontroller<uiscrollviewdelegate> @end

viewcontroller.m//scrollview01////Created by Mac on 15-7-14.//Copyright (c) 2015 Mac. All rights reserved.//#import the usage of "ViewController.h"//scrollview @interface viewcontroller () @end @implementation viewcontroller-(void) viewdidload {[Super viewdidload];//create ScrollView uiscrollview * Scro = [[Uiscrollview alloc]in    Itwithframe:cgrectmake (100, 100, 200, 300)];    [Self.view Addsubview:scro];    Scro.delegate = self;    Scro.backgroundcolor = [Uicolor Orangecolor]; Set the content size Scro.contentsize = Cgsizemake (400, 400);//used to understand the difference between content size and frame uiimageview *imageview = [[Uiimageview alloc]in    Itwithframe:cgrectmake (0, 0, 390, 390)];    UIImage *image = [UIImage imagenamed:@ "20120618101.jpg"];    Imageview.image = image;    NSLog (@ "%@", imageview.image);    [Scro Addsubview:imageview];    Whether to display horizontal and vertical scrollbars/* scro.showshorizontalscrollindicator = NO;    Scro.showsverticalscrollindicator = NO;  Whether there is a spring effect scro.bounces = NO; *//Add additional scrolling area Scro.contentinset = UiedgeinsetsMake (30, 30, 30, 30);    Set scroll bar style Scro.indicatorstyle = Uiscrollviewindicatorstyleblack;    Set Offset Scro.contentoffset = Cgpointmake (-20,-20);    Whether the page slip scro.pagingenabled = YES; Whether to turn on scrolling//scro.scrollenabled = NO;} #define The Mark Proxy method//slide when called-(void) Scrollviewdidscroll: (Uiscrollview *) scrollview{//NSLog (@ "%@", ScrollView);} When you start dragging, call to let go-(void) scrollviewwillbegindragging: (Uiscrollview *) scrollview{NSLog (@ "sssss%@", ScrollView);} End drag, finger away from screen, decelerate (whether deceleration state)-(void) scrollviewdidenddragging: (Uiscrollview *) ScrollView willdecelerate: (BOOL ) decelerate{//decelerate = = YES? NSLog (@ "deceleration"): NSLog (@ "Stop");} Start slow down call-(void) scrollviewwillbegindecelerating: (Uiscrollview *) scrollview{//NSLog (@ "Start slowing down");} Slow Stop call-(void) scrollviewdidenddecelerating: (Uiscrollview *) ScrollView {//NSLog (@ "deceleration stop");} Drag, finger off screen-(void) scrollviewwillenddragging: (Uiscrollview *) ScrollView withvelocity: (cgpoint) Velocity Targetcontentoffset: (inout cgpoint *) targetcontentoffset{//Get coordinates, only makeWith the pointer float tagetx = targetcontentoffset->x;//NSLog (@ "%.2f", Tagetx);} 

There may be something missing, or the explanation is not accurate, please note that changes will be made.

ScrollView properties, and Agent method summary

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.