首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何将UIButton的标题设置为左对齐?

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

提问于 2017-12-21 11:03:45
回答 2关注 0查看 320

我需要显示从左侧的电子邮件地址UIButton,但它被放置在中心。

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

这是我现在的代码:

代码语言:txt
复制
UIButton* emailBtn = [[UIButton alloc] initWithFrame:CGRectMake(5,30,250,height+15)];
代码语言:txt
复制
emailBtn.backgroundColor = [UIColor clearColor];
代码语言:txt
复制
[emailBtn setTitle:obj2.customerEmail forState:UIControlStateNormal];
代码语言:txt
复制
emailBtn.titleLabel.font = [UIFont systemFontOfSize:12.5];
代码语言:txt
复制
[emailBtn setTitleColor:[[[UIColor alloc]initWithRed:0.121 green:0.472 blue:0.823 alpha:1]autorelease] forState:UIControlStateNormal];
代码语言:txt
复制
[emailBtn addTarget:self action:@selector(emailAction:) forControlEvents:UIControlEventTouchUpInside];
代码语言:txt
复制
[elementView addSubvie

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档