美文网首页iOS Developer
frame, bounds, contentOffset, co

frame, bounds, contentOffset, co

作者: iOneWay | 来源:发表于2016-08-19 11:36 被阅读64次

1, frame很容易理解,就是view视图在superView视图的区域。

2,bounds

  • 普通View视图,bounds.origin = (0, 0)
  • 可滑动的视图,如tableView,scrollView。bounds.origin = self.contentOffset;

bounds的origin其实就是以UIScrollView中的content的左上角为坐标原点时,UIScrollView左上角在该坐标系下的坐标值。

3, contentOffset
scrollView才有的属性。和bounds的origin值一样,是以UIScrollView中的content的左上角为坐标原点时,UIScrollView左上角在该坐标系下的坐标值。

4,contentInset
类似于css中padding属性。
scrollView.contentInset = UIEdgeInsetsMake(50, 0, 0, 0);
这样定义后,内容视图开始的origin坐标为(0,51)。

其中:UIEdgeInsetsMake(top, left , bottom , right );

相关文章

网友评论

    本文标题:frame, bounds, contentOffset, co

    本文链接:https://www.haomeiwen.com/subject/zodbsttx.html