相关疑难解决方法(0)

如何将UIButton的标题设置为左对齐?

我需要从a的左侧显示电子邮件地址UIButton,但它位于中心.

有没有办法将对齐设置为左侧UIButton

这是我目前的代码:

UIButton* emailBtn = [[UIButton alloc] initWithFrame:CGRectMake(5,30,250,height+15)];
emailBtn.backgroundColor = [UIColor clearColor];
[emailBtn setTitle:obj2.customerEmail forState:UIControlStateNormal];
emailBtn.titleLabel.font = [UIFont systemFontOfSize:12.5];
[emailBtn setTitleColor:[[[UIColor alloc]initWithRed:0.121 green:0.472 blue:0.823 alpha:1]autorelease] forState:UIControlStateNormal];
[emailBtn addTarget:self action:@selector(emailAction:) forControlEvents:UIControlEventTouchUpInside];
[elementView addSubview:emailBtn];
[emailBtn release];
Run Code Online (Sandbox Code Playgroud)

objective-c uibutton

458
推荐指数
9
解决办法
20万
查看次数

如何将图像放在UIButton中文本的右侧?

如果可以避免,我不想使用子视图.我想要一个UIButton背景图片,文字和图像.现在,当我这样做时,图像位于文本的左侧.背景图像,文本和图像都具有不同的突出显示状态.

layout user-interface uibutton ios

284
推荐指数
17
解决办法
15万
查看次数

将按钮图像对齐到UIButton的右边缘

关于根据标题文本对齐按钮图像有很多线索,但我找不到任何关于将图像对齐到按钮右侧的信息.

这没有效果:

button.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 50);
Run Code Online (Sandbox Code Playgroud)

如何将图像右键对齐按钮?可以在故事板中完成吗?

xcode uibutton uiimage ios uiedgeinsets

23
推荐指数
8
解决办法
4万
查看次数