美文网首页iOS开发相关
Bounds 和 Frame 的区别

Bounds 和 Frame 的区别

作者: LOVE婷 | 来源:发表于2017-09-01 16:25 被阅读0次

闲来无事, 想到之前面试时有问到bounds和frame的区别的问题,索性就写了一个简单的控件,验证一下,大家请看下图:

     从打印的坐标可以看出, frame和bounds的区别就是在于x坐标及y坐标,对于一个控件来说,frame的原点是任意的(相对于父视图中的坐标位置),而bounds的原点是(0,0)点(就是view本身的坐标系统,默认永远都是0,0点,除非认为setbounds), 这就是两个坐标的区别!

相关文章

  • iOS纪录

    (1)View的Frame与Bounds区别 摘自 ios view的frame和bounds之区别(位置和大小)...

  • 深入探究frame和bounds的区别以及setbounds使用

    深入探究frame和bounds的区别以及setbounds使用 深入探究frame和bounds的区别以及set...

  • iOS 面试题目

    1、iOS frame和Bounds 以及frame和bounds区别2、 ios webView 加载HTML字...

  • #1 布局相关的问题集合

    1.frame 和 bounds的区别 what's the difference bewteen frame a...

  • UI基础相关

    UI基础相关: Frame 和 bounds的区别:Frame是参照父控件的 bounds是参照自己的 默认是(0...

  • frame和bounds区别

    1、frame不管对于位置还是大小,改变的都是自己本身 2、frame的位置是以父视图的坐标系为参照,从而确定当前...

  • iOS~ frame 和 bounds 的区别和联系

    推荐文章Understanding UIScrollView 1、 frame 和 bounds 的区别和联系 f...

  • bounds和frame的区别

    此情况下,在view.bounds = CGRectMake(x, y, W, H)中,无论x、y怎么设置最后打印...

  • frame 和 bounds 的区别

    frame frame是每个view必备的属性,代表的是当前视图的位置和大小,没有设置他,当前视图是看不到的。 b...

  • frame和bounds的区别

    frame: 该view在父view坐标系统中的位置和大小。(参照点是,父亲的坐标系统) bounds:该view...

网友评论

    本文标题:Bounds 和 Frame 的区别

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