美文网首页
UIButton 交换位置

UIButton 交换位置

作者: Smallwolf_JS | 来源:发表于2019-08-19 18:47 被阅读0次
    CGFloat space = 3;
        _nameBtn.titleEdgeInsets = UIEdgeInsetsMake(0, - _nameBtn.imageView.v_width - space, 0, _nameBtn.imageView.v_width +space);
        _nameBtn.imageEdgeInsets = UIEdgeInsetsMake(0,_nameBtn.titleLabel.v_width + space, 0, - _nameBtn.titleLabel.v_width - space);
    

    上下位置交换

    - (void)resetBtnUI:(UIButton *)btn{
        [btn setTitleEdgeInsets:UIEdgeInsetsMake(50,- btn.imageView.size.width, 0, 0)];
        [btn setImageEdgeInsets:UIEdgeInsetsMake(-50, 0, 0,- btn.titleLabel.size.width)];
    }
    

    相关文章

      网友评论

          本文标题:UIButton 交换位置

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