简体   繁体   English

右侧标题中的UIButton图像

[英]UIButton image on right title in center

I was searching through the post and trying to figure it out by myself but it is hardly working. 我一直在搜索该帖子,并试图自己找出它,但是它几乎没有用。

I want to use an UIButton with image and title. 我想使用带有图像和标题的UIButton
UIButton spans across (almost) whole screen. UIButton跨越(几乎)整个屏幕。
The image should be positioned on the right edge of the button. 图像应位于按钮的右边缘。
The title should be centered in the whole button. 标题应位于整个按钮的中心。

How can I do it with insets? 如何处理插图?

Thanks to the link provided I have used 多亏了我提供的链接

Control.ContentEdgeInsets = new UIEdgeInsets(0, -imageWidth, 0, 0);
Control.ImageEdgeInsets = new UIEdgeInsets(0, controlWidth, 0, 0);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM