在alert提示框中,需要根据分号换行,先看一种复杂的方法
NSString* str=@"123;456;789";
NSArray *arry=[str componentsSeparatedByString:@";"];
NSString *str2=[[NSString alloc]init];
for (NSString *mystr in arry) {
str2=[str2 stringByAppendingFormat:@"\n%@",mystr];
}
NSLog(@"%@",str2);
再看一种简单的方法
tips = [tips stringByReplacingOccurrencesOfString:@";" withString:@"\n"];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"更新提示!" message:tips preferredStyle:UIAlertControllerStyleAlert];
放到alertcontroller中左对齐,效果如下
alerter中左对齐效果,参考具体微博:
http://blog.youkuaiyun.com/lee727n/article/details/78053822