UIButton*button=[[UIButton alloc]initWithFrame:CGRectMake(100,100,200,40)];button.backgroundColor=[UIColor redColor];[button setTitle:@"我是11111\n 我要换行"forState:UIControlStateNormal];button.titleLabel.lineBreakMode=0;//这句话很重要,不加这句话加上换行符也没用[self.view addSubview:button];
此文章为转载 , 原文地址:https://www.jianshu.com/p/0b90eeb8f1a3
网友评论