About UiScrollView/NSTime/UIPageControl(2015411)

来源:互联网 发布:机智股票自动交易软件 编辑:程序博客网 时间:2024/06/09 22:50
1.UIScrollView
初始化:[[UIScrollView alloc] initWithFrame:CGRectMake(…)];
大小设置:contentSize=CGSizeMake();
垂直条:showsVerticalScrollIndicator
水平条:showsHorizontalScrollIndictor
一页一页的效果:pageEnabled
弹簧效果:bounces=NO
设置scrollView的位置
[XXX setContentOffset:CGPointMake(x, 0) animated:YES]
代理:
#pragma mark 开始拖动滚动条
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
#pragma mark 结束滚动滚动条
-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate


2.NSTimer

初始化:[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(clickTime) userInfo:nil repeats:YES]
默认的是:NSDefaultRunLoopMode
第二种定时器的创建:
[NSTimer timerWithTimeInterval:2.0 target:self selector:@selector(clickTime) userInfo:nil repeats:YES];
 [[NSRunLoop currentRunLoop] addTimer:self.time forMode:NSRunLoopCommonModes];
NSRunLoopCommonModes:不会受到另外的控件的影响
删除定时器:[self.time invalidate]


3.UIPageControl

初始化:[UIPageControl alloc] init
页数:numberOfPages
得到最合适的大小;       
 // 控件尺寸,得到控件最合适的宽度和高度
 CGSize size = [_pageControl sizeForNumberOfPages:kCountPic];
不选中按钮的颜色:
pageIndicatorTintColor
选中颜色:
currentPageIndicatorTintColor
当前的页数:

currentPage
0 0
原创粉丝点击