主要是理解下 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 );   构造出,分别表示其中的内容/标题/图片离各边的距离。

相关文章:

  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
  • 2021-06-28
猜你喜欢
  • 2021-07-13
  • 2022-01-05
  • 2022-12-23
  • 2022-03-08
  • 2022-12-23
  • 2021-04-06
相关资源
相似解决方案