Code Bye

请问:如何调整xcode中加入的控件层次

 

我有2个按钮,后加入的那个总在先加入的那个上面,但是我想让他在下面不要遮挡按钮1,如何解决?谢谢


10分
– (void)bringSubviewToFront:(UIView *)view;
– (void)sendSubviewToBack:(UIView *)view;

30分
用鼠标把视图对应的列表拖到下面。
如:显示view,
          label1,
          label2.
要想让label1在上层,把label1拖到label2下面就可以了。(昨天在狮子系统中试过)。
– (void)bringSubviewToFront:(UIView *)view;
– (void)sendSubviewToBack:(UIView *)view;
直接将按钮2 拖到view的试图上,就不会覆盖了
1楼正解。
更复杂的改变view层次的方法:

– (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;
– (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;

– (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;
– (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2;


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明请问:如何调整xcode中加入的控件层次