第12月第2天 uiscrollview _adjustContentOffsetIfNecessary 圆角

1.

uiscrollview在调用setFrame,setBounds等方法的时候会默认调用稀有api: _adjustContentOffsetIfNecessary

这个方法会改变当前的contentOffset值

如果没有设置 

self.automaticallyAdjustsScrollViewInsets = NO;

那么

(CGPoint) contentOffset = (x = 0, y = -20)

 

http://04rjgchyq.blog.163.com/blog/static/175937163201293044058562/

2.

单独禁止下拉

    if (_tableView.contentOffset.y < 0) {

        _tableView.contentOffset = CGPointMake(0, 0);

    }

 

http://www.jianshu.com/p/20697a712879

3.圆角

    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerTopLeft cornerRadii:CGSizeMake(16, 16)];

    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];

    maskLayer.frame = view.bounds;

    maskLayer.path = maskPath.CGPath;

    view.layer.mask = maskLayer;

 

http://www.jianshu.com/p/cb192de530e2

原文地址:https://www.cnblogs.com/javastart/p/7465989.html