相关疑难解决方法(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万
查看次数

标签 统计

objective-c ×1

uibutton ×1