UIButton

作者: 林希品 | 来源:发表于2021-11-02 09:10 被阅读0次

    场景一:上图下字

    button.titleEdgeInsets =UIEdgeInsetsMake(.0, - button.imageView.bounds.size.width -10.0,.0, button.imageView.bounds.size.width);

    button.imageEdgeInsets =UIEdgeInsetsMake(.0, button.titleLabel.bounds.size.width,.0, - button.titleLabel.bounds.size.width);

    场景二:左字右图

    button.titleEdgeInsets =UIEdgeInsetsMake(.0, - button.imageView.bounds.size.width -10.0,.0, button.imageView.bounds.size.width);

    button.imageEdgeInsets =UIEdgeInsetsMake(.0, button.titleLabel.bounds.size.width,.0, - button.titleLabel.bounds.size.width);

    场景二:左字右图

    [button setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];

    button.imageEdgeInsets = UIEdgeInsetsMake(0, 3, 0, 35);

    button添加阴影

            skipButton.layer.shadowOffset =  CGSizeMake(1, 1);

            skipButton.layer.shadowOpacity = 0.8;

            skipButton.layer.shadowColor =  [UIColor colorWithWhite:0 alpha:0.1].CGColor;

            skipButton.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2];

    相关文章

      网友评论

          本文标题:UIButton

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