UIScrollView 期本使用方法

      myScroll=[[UIScrollView alloc] initWithFrame:CGRectMake(50, 120, 617, 131*6)];
        myScroll.bounces = YES; //是不有拉申返弹的效果
        myScroll.pagingEnabled = YES;//是否分页显示
        myScroll.delegate = self;//设定理方法
        myScroll.userInteractionEnabled = YES;
        myScroll.showsHorizontalScrollIndicator=NO;//是否显示水平滑动条
        myScroll.showsVerticalScrollIndicator= NO;//是否显示竖直滑动条
        //设定scrollView滑动的大小范围
        myScroll.contentSize = CGSizeMake(myScroll.frame.size.width * [self.myArray count],myScroll.frame.size.height);
        [self.view addSubview:myScroll];
        [myScroll release];


#pragma mark UIScrollViewDelegate
//只要滚动了就会触发
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
{
   NSLog(@"ContentOffset  x is  %f,yis %f",scrollView.contentOffset.x,scrollView.contentOffset.y);
}
//开始拖拽视图
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;
{
    NSLog(@"开始拖拽视图");
}
//完成拖拽
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;
{
    NSLog(@"完成拖拽");
}
//将开始降速时
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;
{
    NSLog(@"将开始降速时");
}

//减速停止了时执行,手触摸时执行执行
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;
{
    NSLog(@"减速停止了时执行,手触摸时执行执行");
}
//滚动动画停止时执行,代码改变时出发,也就是setContentOffset改变时
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView;
{

    NSLog(@"滚动动画停止时执行,代码改变时出发,也就是setContentOffset改变时");
}
//设置放大缩小的视图,要是uiscrollview的subview
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;
{
    NSLog(@"设置放大缩小的视图,要是uiscrollview的subview");
    return nil;
}
//完成放大缩小时调用
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale;
{
    NSLog(@"s完成放大缩小时调用");
}

 

posted @ 2015-07-04 12:33  Qingyun_Qearl  阅读(166)  评论(0编辑  收藏  举报