iOS UIScrollView basic usage and proxy methods

- (void)viewDidLoad{

[superviewDidLoad];

scrollView = [[UIScrollViewalloc] initWithFrame:CGRectMake(0,0,320,460)];

scrollView.backgroundColor = [UIColorredColor];

// whether to support the top of the slide

scrollView.scrollsToTop = NO;

scrollView.delegate =self;

// set the size of the content scrollView.contentSize = CGSizeMake (320,460 * 10);

// if the rebound // scrollView.bounces = NO;

// whether paging // scrollView.pagingEnabled = YES;

// whether scrolling // scrollView.scrollEnabled = NO;

//    scrollView.showsHorizontalScrollIndicator = NO;

// set the indicator style // scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;

// set contents Indicators edge and edge // scrollView.contentInset = UIEdgeInsetsMake (0, 50, 50, 0);

//    scrollView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 50, 0, 0);

// prompt the user, Indicators flash [scrollView flashScrollIndicators];

// whether simultaneous movement, lockscrollView.directionalLockEnabled = YES;

[self.view addSubview:scrollView];

UILabel*label = [[UILabelalloc] initWithFrame:CGRectMake(0,200,320,40)];

label.backgroundColor = [UIColoryellowColor];label.text =@"学习scrolleview";

[scrollView addSubview:label];[label release];}#pragma mark -/*

// Returns an enlarged view or reduced

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView

{

}

// start enlarging or reducing

- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:

(UIView *)view

{

}

// end when zooming

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale

{

}

// view has been enlarged or reduced

- (void)scrollViewDidZoom:(UIScrollView *)scrollView

{

NSLog(@"scrollViewDidScrollToTop");

}

* /// support to the top slide - (BOOL) scrollViewShouldScrollToTop: (UIScrollView *) scrollView {returnYES;}

// called when slid to the top - (void) scrollViewDidScrollToTop: (UIScrollView *) scrollView {NSLog (@ "scrollViewDidScrollToTop");}

// scrollView has slid - (void) scrollViewDidScroll: (UIScrollView *) scrollView {NSLog (@ "scrollViewDidScroll");}

// scrollView 开始拖动- (void)scrollViewWillBeginDragging:(UIScrollView*)scrollView{NSLog(@"scrollViewWillBeginDragging");}

// scrollView 结束拖动- (void)scrollViewDidEndDragging:(UIScrollView*)scrollView willDecelerate:(BOOL)decelerate{NSLog(@"scrollViewDidEndDragging");}

// scrollView deceleration start (note the distinction between the two methods above two methods) - (void) scrollViewWillBeginDecelerating: (UIScrollView *) scrollView {NSLog (@ "scrollViewWillBeginDecelerating");}

// scrollview 减速停止- (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView{NSLog(@"scrollViewDidEndDecelerating");

 

 

 

Guess you like

Origin www.cnblogs.com/Yishu/p/12068807.html