在这些UIImageView,UIView,UITextField,UILabel,UIButton学完了之后,记得最深的就是UITextField中可以直接添加边框的方法是 textField.borderStyle。

  那么其他的空间设置边框设置记得不清的原因是因为 中间有个layer。下面看下具体的操作:

  用UILabel来举例子:

   //设置label的边框

        _upLabel.layer.borderColor=[[UIColor grayColor]CGColor];  //边框的颜色

        _upLabel.layer.borderWidth = 1; //边框的宽度

        //给label的边框设置圆角

        _upLabel.layer.masksToBounds = YES;

        _upLabel.layer.cornerRadius = 10//设置圆角大小

  以上应该注意的是Laber的宽度 .layer.borderWidth必须设置,且为正数,不然运行界面是不显示边框的。

 

  新手学习中,有不足之处请大侠指正。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-19
  • 2022-12-23
  • 2021-12-26
  • 2021-07-30
  • 2022-12-23
  • 2021-08-30
相关资源
相似解决方案