我有一个UIButton,按钮上的文本通常会居中显示,但当文本字符串变长时,文本的大小会缩小。这时,文本似乎会粘在textField的底部而不是保持在按钮中央。
self.titleBtn.titleLabel.adjustsFontSizeToFitWidth = YES;
self.titleBtn.titleLabel.minimumScaleFactor = .2;
[self.descriptionBtn setTitle:@"T" forState:UIControlStateNormal];
//works normally
但是
[self.descriptionBtn setTitle:@"This a longer title" forState:UIControlStateNormal];
//is vertically lower than center