IOS 语法

主要是理解下 UIEdgeInsets 在IOS UI里的意义。其实 UIEdgeInsets 就是控件的内容与各边的间隔。正值表示间隔值,负值表示超出参照物的距离。

但是在 IOS 的控件,只有 UIButton 可以设置 Padding/Insets,即按钮上文字或图片与按钮边界的间隙,对与 CSS 来说叫做 Padding,在 iOS 中叫做 Insets,UIButton 设置 Insets 相应的属性如下:

Configuring Edge Insets

      contentEdgeInsets  property
      titleEdgeInsets  property
      imageEdgeInsets  property 

它们接受的属性类型是:UIEdgeInsets,由函数 UIEdgeInsetsMake ( CGFloat top, CGFloat left, CGFloat bottom, CGFloat right );   构造出,分别表示其中的内容/标题/图片离各边的距离。

原文地址:https://www.cnblogs.com/ziyeSky/p/4198605.html