iOS- UIButton的上图下文居中对称简单实现

2018-08-22  本文已影响21人  fly大梦想家
        button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        button.titleEdgeInsets = UIEdgeInsetsMake(button.imageView.frame.size.height, -button.imageView.frame.size.width, 0, 0);
        button.imageEdgeInsets = UIEdgeInsetsMake(-button.imageView.frame.size.height, 0, 0, - button.titleLabel.bounds.size.width);

上面两button


Simulator Screen Shot - iPhone X - 2018-08-22 at 13.59.24.png
上一篇 下一篇

猜你喜欢

热点阅读