UI基础6 UIScrollView NSTimer

2016-07-21  本文已影响24人  SoManyDumb

UIScrollView

什么是UIScrollView

UIScrollView的基本使用

UIScrollView无法滚动的解决办法

UIScrollView的常见属性

@property(nonatomic) CGPoint contentOffset;
@property(nonatomic) CGSize contentSize;
@property(nonatomic) UIEdgeInsets contentInset;

UIScrollView的其他属性

 @property(nonatomic) BOOL bounces;
@property(nonatomic,getter=isScrollEnabled) BOOL
scrollEnabled;
@property(nonatomic) BOOL showsHorizontalScrollIndicator;
@property(nonatomic) BOOL showsVerticalScrollIndicator;

UIScrollView的代理(delegate)

缩放实现步骤

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;
- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view
- (void)scrollViewDidZoom:(UIScrollView *)scrollView

分页

@property(nonatomic) NSInteger numberOfPages;
@property(nonatomic) NSInteger currentPage;
@property(nonatomic) BOOL hidesForSinglePage;
@property(nonatomic,retain) UIColor *pageIndicatorTintColor;
@property(nonatomic,retain) UIColor *currentPageIndicatorTintColor;

NSTimer

+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti
target:(id)aTarget
    selector:(SEL)aSelector
    userInfo:(id)userInfo
    repeats:(BOOL)yesOrNo;
//每隔ti秒,调用一次aTarget的aSelector方法,yesOrNo决定了是否重复执行这个任务
 - (void)invalidate;
NSTimer *timer = [NSTimer timerWithTimeInterval:2 target:self selector:@selector(next) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
上一篇 下一篇

猜你喜欢

热点阅读