zoukankan      html  css  js  c++  java
  • IOS中Label,imageView,view,button怎么添加边框?

      在这些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必须设置,且为正数,不然运行界面是不显示边框的。

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

  • 相关阅读:
    strncat_s
    资源编译器 (.rc) 文件
    C++ Namespace 详解
    Structure Definitions
    SetParent
    C++笔记(1)explicit构造函数
    .def
    tellg()和tellp()
    Data Groups
    Messages
  • 原文地址:https://www.cnblogs.com/ios988/p/5136493.html
Copyright © 2011-2022 走看看