UIScroView

1.常见属性

 @propety(nomatomic) CGPonit contentOfset;//这个属性用来表示滚动的位置,内容左上角与scroview左上角的间距值(x,y)
@property(nomatomic)CGSzise contentSize;//滚动范围,能滚多远
@property(nomatomic)UIEdegeInsets contentInsize;四周增加额外的滚动区域。

2.常见动画

  • 2.1
CGPoint offset =CGPointMake(_scoview.contentOffset.x, 0);
    [self.scoview setContentOffset:offset animated:YES];
  • 2.2


[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:5.0];
    [UIView setAnimationDelegate:self];//动画的代理
    [UIView setAnimationDidStopSelector:@selector(stop)];//动画执行停止后,需要执行的方法。
    [UIView setAnimationWillStartSelector:@selector(start)];//动画开始的时候执行的方法。(方法在代理里面)
//中间写上上执行的动画代码
[UIView commitAnimations];

    
  • 2.3
[UIView animateWithDuration:4.0 animations:^{
        self.scoview.contentOffset = CGPointMake(0, _scoview.contentOffset.y);
    } completion:^(BOOL finished){
        NSLog(@"执行完毕");
        
    }];
  • 2.4
  CGFloat Y =_scoview.contentSize.height -_scoview.frame.size.height;
    CGPoint offset =CGPointMake(0, Y);
    [UIView animateWithDuration:2.0 animations:^{
        self.scoview.contentOffset =offset; //  位置被人改,大小被人改。ui控      件的属性被人改了。动画才会起效果
        
    }];
   
    // 不允许修改直接修改对象结构体属性的成员变量。所有一直用的都是CGPointMake。
    
    
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容