按钮旋转后文本被截断

时间:2013-10-21 05:42:44

标签: ios button rotation label

旋转按钮时无法解决此问题。

这是我的代码:

newButton.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"btn_maintab_60x146.png"]];
newButton.frame = CGRectMake(0, 0, 60, 146);
[newButton.titleLabel setFont:[UIFont fontWithName:@"Baskerville-SemiBold" size:21.0f]];[newButton.titleLabel setFrame:CGRectMake(0, 0, 60, 146)];
[newButton.titleLabel setTransform:CGAffineTransformMakeRotation(M_PI_2)];
[newButton setTitle:title forState:UIControlStateNormal];

按钮变成这样:

enter image description here

1 个答案:

答案 0 :(得分:0)

按钮文字使用以下代码。

[newButton.titleLabel setTransform:CGAffineTransformMakeRotation(M_PI / 2)];