相关疑难解决方法(0)

在UIButton上左对齐图像和中心文本

我见过有关正确对齐的帖子,但我无法让左对齐工作.我希望按钮占据屏幕的宽度,左侧是图像,中间是标题/文字.

这不起作用(至少可靠):

    button.titleLabel.textAlignment = UITextAlignmentCenter;
    [button setImageEdgeInsets:UIEdgeInsetsMake(0, -60.0, 0, 0)];
    button.frame = CGRectMake((self.view.frame.size.width - w ) / 2, self.view.frame.size.height - 140.0,  self.view.frame.size.width - 10.0, 40.0);
Run Code Online (Sandbox Code Playgroud)

uibutton uiimage ios

57
推荐指数
11
解决办法
6万
查看次数

为什么自定义UIButton图像不会在Interface Builder中调整大小?

为什么自定义UIButton图像不会随按钮调整大小?

我将其视图模式设置为Scale to Fill in Interface Builder,但与UIImageView图像不同,它不尊重该设置.

我在错误的地方寻找还是不可能?

cocoa-touch interface-builder uibutton ios

44
推荐指数
7
解决办法
7万
查看次数

标签 统计

ios ×2

uibutton ×2

cocoa-touch ×1

interface-builder ×1

uiimage ×1