有些时候我们可能需要在UIButton上显示两行,或者多行。 iOS6以前版本: button.titleLabel.lineBreakMode = UILineBreakModeWordWrap; button.titleLabel.textAlignment = UITextAlignmentCenter; iOS 6以后版本: button.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; button.titleLabel.textAlignment = NSTextAlignmentCenter; 设定UIButton的文字 [button setTitle: @"Line1\nLine2" forState: UIControlStateNormal];
转载于:https://www.cnblogs.com/liuxingzi/archive/2013/02/17/3404317.html