iphone - uibutton 文本对齐

标签 iphone uibutton

我试图在 UIButton 上左对齐文本。默认情况下它是中间对齐的。以下似乎不起作用。有人可以建议什么可能有效吗。

  aButton.titleLabel.textAlignment = UITextAlignmentLeft; 

最佳答案

您必须设置标签对齐方式,而不是文本对齐方式。

aButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

关于iphone - uibutton 文本对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3923344/

相关文章:

ios - 找到满足 `ParseFacebookUtils` 依赖项的规范,但它们需要更高的最低部署目标

ios - 我想在 iOS 5.x 中隐藏一个 Button 但在 iOS 6.x 中不

ios - 在 Storyboard上使用 UIButton 子类会使按钮的边框消失

ios - 为 TableViewCell 创建一个 UI 按钮

ios - 神秘的 UIButton 崩溃

ios - 查找每个季度中两个日期之间的天数

iphone - CALayer 中的 anchor

iphone - 通过 UIButton 将 UITableViewController 移回顶部

ios - UIButton Touch Down 没有在 Swift 中注册

iphone - Objective C 中的继承