奇怪的行为。我试图制作切换按钮,改变按钮的标题。 但不是" Done"它告诉我" ..." :
方法:
-(IBAction)toggleEditingMode:(id)sender
{
if(self.isEditing){
[sender setTitle:@"Edit" forState:UIControlStateNormal];
[self setEditing:NO animated:YES];
}
else if(!self.isEditing){
[sender setTitle: @"Done" forState:UIControlStateNormal];
[self setEditing:YES animated:YES];
}
}
答案 0 :(得分:3)
它的截断,要么按钮需要更大,要么文本需要更小。
动态调整文字
yourButton.titleLabel.adjustsFontSizeToFitWidth = YES;
yourButton.titleLabel.minimumScaleFactor = 0.5;
答案 1 :(得分:3)
您可以在设置Barberton项后添加此代码。它工作正常。
[[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor clearColor]} forState:UIControlStateNormal];