标记子view的bordColor 调试UI布局

来源:互联网 发布:虚拟光驱软件哪个好 编辑:程序博客网 时间:2024/05/21 10:58

有时候在写代码布局UI的时候不好调节Ui的位置,可以用不同的颜色标记出各个view,特别是神马都不显示的时候特别有用。


- (void)markBorderWithRandomColor{


    self.layer.borderColor =RGBCOLOR(arc4random() % 255,

                                      arc4random() %255,

                                      arc4random() %255).CGColor;

    self.layer.borderWidth =1.0f;

}


- (void)markBorderWithRandomColorRecursive{

    [selfmarkBorderWithRandomColor];


    for (UIView *v in self.subviews) {

        [v markBorderWithRandomColorRecursive];

    }

}

原创粉丝点击