美文网首页
UIButton小知识

UIButton小知识

作者: 笃行丶 | 来源:发表于2021-04-29 19:40 被阅读0次
    1. 水平设置内容 可以设置一下属性
      //typedef NS_ENUM(NSInteger, UIControlContentHorizontalAlignment) {
      //UIControlContentHorizontalAlignmentCenter = 0,
      //UIControlContentHorizontalAlignmentLeft = 1,
      //UIControlContentHorizontalAlignmentRight = 2,
      //UIControlContentHorizontalAlignmentFill = 3,
      //UIControlContentHorizontalAlignmentLeading API_AVAILABLE(ios(11.0), tvos(11.0)) = 4,
      //UIControlContentHorizontalAlignmentTrailing API_AVAILABLE(ios(11.0), tvos(11.0)) = 5,
      //};
      _button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    2. 设置内容间距:
      _button.contentEdgeInsets = UIEdgeInsetsMake(0, 16, 0, 0);

    相关文章

      网友评论

          本文标题:UIButton小知识

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