美文网首页
UIButton的属性imageEdgeInsets,title

UIButton的属性imageEdgeInsets,title

作者: gleeeli | 来源:发表于2023-05-29 14:00 被阅读0次

UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)

其中包含的四个参数意义为:正值为靠近控件矩形区域的中心,负值为远离控件矩形区域的中心。

比如:imageEdgeInsets = UIEdgeInsets(top: -24, left: 0, bottom: 0, right: 0)

-24代表:远离图片的中心24像素,也就是上移24像素。(但是实际测试结果是上移12,不知原因???)

比如:imageEdgeInsets = UIEdgeInsets(top: -24, left: 0, bottom: 24, right: 0)

bottom:24代表:底部靠近中心区域24像素,也是上移24像素。(这里top和bottom都是上移动24,实际结果才是24像素,不明???)

相关文章

网友评论

      本文标题:UIButton的属性imageEdgeInsets,title

      本文链接:https://www.haomeiwen.com/subject/zpvjedtx.html