Ios 在某一点将UILabel分成两行
如果我有这样的UILabel:Ios 在某一点将UILabel分成两行,ios,ios7,uilabel,Ios,Ios7,Uilabel,如果我有这样的UILabel: UILabel *errorLabel = [[UILabel alloc] initWithFrame:CGRectMake(30.0, 90.0, [self screenWidth] - 70.0, 50.0) ]; errorLabel.numberOfLines = 2.0; errorLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:(12.0)]; errorLabel.t
UILabel *errorLabel = [[UILabel alloc] initWithFrame:CGRectMake(30.0, 90.0, [self screenWidth] - 70.0, 50.0) ];
errorLabel.numberOfLines = 2.0;
errorLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:(12.0)];
errorLabel.text = @"Error: The email and/or password are incorrect. Try again.";
如何在密码处拆分文本,使其按如下方式吐出:
The email and/or password
are incorrect. Try again.
只需插入新行:
errorLabel.text = @"Error: The email and/or password\nare incorrect. Try again.";
您已经设置了
numberOfLines
属性,这一点也很重要。这很简单,应该知道这一点:o)