Sunday, March 8, 2009

UIView

- [rootView addSubView:newView]

newView 将被添加到 [[rootView subViews] count]处。
举个例子,如果rootView已经有3个subview,当 addSubView操作后,rootView含有4个subview,最后一个subview为刚刚被添加的newView。最新被添加的view处于屏幕的最前面。

下面的代码将最后一个subview从subviews中删除:
[[[rootView subviews] objectAtIndex:[[rootView subViews] count]-1] removeFromSuperview];

- 给view加个标签
setTag可以给view加上标签,这样就可以很容易取回想要view:viewWithTag


No comments:

Post a Comment