如果我有这样的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.text = @"Error: The email and/or password are incorrect. Try again.";
如何将文本分割为密码,以便将其吐出:
The email and/or password
are incorrect. Try again.
答案 0 :(得分:1)
只需插入换行符:
errorLabel.text = @"Error: The email and/or password\nare incorrect. Try again.";
您已经设置了numberOfLines
属性,这也很重要。