标签:
1 // 设置滚动范围,这里用图片实际大小 2 self.scrollView.contentSize = self.imageView.frame.size;
1 // 表示滚动位置,相对于初始位置 2 @property(nonatomic) CGPoint contentOffset; 3 4 // 表示尺寸、滚动范围 5 @property(nonatomic) CGSize contentSize; 6 7 // 这个属性能够增加四周额外的滚动范围 8 @property(nonatomic) UIEdgeInsets contentInset;
1 // 增加边距显示,参数分别是top, left, bottom, right 2 self.scrollView.contentInset = UIEdgeInsetsMake(10, 20, 40, 80);
1 // 移动到(200, 300)位置 2 self.scrollView.contentOffset = CGPointMake(200, 300);
1 // 是否需要弹簧效果 2 @property(nonatomic) BOOL bounces; 3 4 // 是否能够滚动 5 @property(nonatomic,getter=isScrollEnabled) BOOL scrollEnabled; 6 7 // 显示水平滚动条 8 @property(nonatomic) BOOL showsHorizontalScrollIndicator; 9 10 // 显示垂直滚动条 11 @property(nonatomic) BOOL showsVerticalScrollIndicator;
1 @property(nonatomic,assign) id<UIScrollViewDelegate> delegate; // default nil. weak reference
1 #import <UIKit/UIKit.h> 2 @interface ViewController : UIViewController <UIScrollViewDelegate> 3 @end
1 self.scrollView.delegate = self;
1 - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { 2 NSLog(@"开始拖曳"); 3 } 4 5 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 6 NSLog(@"正在拖曳"); 7 } 8 9 - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { 10 NSLog(@"结束拖曳"); 11 }
1 - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view { 2 NSLog(@"开始缩放"); 3 } 4 5 - (void)scrollViewDidZoom:(UIScrollView *)scrollView { 6 NSLog(@"正在缩放"); 7 } 8 9 - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale { 10 NSLog(@"结束缩放"); 11 }
1 - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView { 2 NSLog(@"拖曳完成后减速开始"); 3 } 4 5 - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { 6 NSLog(@"拖曳完成后减速完成"); 7 }
1 // 捏合手势调用的方法 2 - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;
1 // 图片 2 @property (weak, nonatomic) IBOutlet UIImageView *imageView; 3 4 // 缩放手势调用的方法 5 - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { 6 return self.imageView; // 需要放大的ImageView 7 }
1 self.scrollView.maximumZoomScale = 2.0; 2 self.scrollView.minimumZoomScale = 0.1;
1 // 总页数 2 @property(nonatomic) NSInteger numberOfPages; // default is 0 3 // 当前页码 4 @property(nonatomic) NSInteger currentPage; 5 // 只有一页的时候隐藏页码 6 @property(nonatomic) BOOL hidesForSinglePage; // hide the the indicator if there is only one page. default is NO 7 // 其他页码指示颜色 8 @property(nonatomic,retain) UIColor *pageIndicatorTintColor; 9 // 当前页码指示颜色 10 @property(nonatomic,retain) UIColor *currentPageIndicatorTintColor;
1 + (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)yesOrNo; 2 3 - (void)fire;
1 + (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation *)invocation repeats:(BOOL)yesOrNo;
1 // 永久终止工作 2 - (void)invalidate;
标签:
原文地址:http://www.cnblogs.com/kengsir/p/4241305.html