码迷,mamicode.com
首页 > 其他好文 > 详细

addSubview和insertSubview的区别

时间:2014-05-06 19:50:50      阅读:279      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   color   width   

两者都是添加子视图,视图的添加都是以栈的方式,即后进先出。


addSubview 是将view加到所有层的最顶层

相当于将insertSubview的atIndex参数设置成view.subviews count

insertSubview:AtIndex:是根据索引添加到栈里面,可以根据需要添加到对应的栈的位置里面。


总结:

addSubview是加到最后

[self.contentView addSubview:self.mImageView];

insertSubview是加到指定的位置

[self.view insertSubview:_mLoadingWaitView aboveSubview:_mTableView];






addSubview和insertSubview的区别,布布扣,bubuko.com

addSubview和insertSubview的区别

标签:style   blog   class   code   color   width   

原文地址:http://blog.csdn.net/isharestudio/article/details/25113299

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!