【代码笔记】iOS-把换成\n

代码:

【代码笔记】iOS-把<br!>换成\n
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view. //把<br!>换成\n
NSString *string=@"123<br!>456<br!>789";
NSString *newStr=[string stringByReplacingOccurrencesOfString:@"<br!>" withString:@"\n"];
NSString *newNewStr=[newStr stringByReplacingOccurrencesOfString:@"\n" withString:@"<br!>"]; UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(10, 100, 100, 200)];
label.backgroundColor=[UIColor redColor];
label.text=newNewStr;
//下面这个代码很重要,很重要的
label.numberOfLines=0;
[self.view addSubview:label];
}
【代码笔记】iOS-把<br!>换成\n
上一篇:imx6 关闭调试串口


下一篇:stm32外部时钟源8M换成12M后库函数相应修改总结