UIButton - text truncated

前端 未结 1 1842
一向
一向 2021-02-06 22:44

I\'ve created a wide UIButton with Interface Builder (Xcode 4), added in a dummy 5 character title (e.g. Click) and then changed the title text programmatically later.

O

1条回答
  •  执念已碎
    2021-02-06 23:12

    You need to use the UIButton method setTitle:forState:

    [self.myButton setTitle:@"Correct New Title" forState:UIControlStateNormal];
    

    as this will correctly update the size and position of the buttons label. Where as just setting the title with self.myButton.titleLabel.text = @"Wrong New Title"; will not.

    0 讨论(0)
提交回复
热议问题