UILabel *msgLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 45, 0, 0)]; //290 230
msgLabel.backgroundColor = [UIColor lightTextColor];
[msgLabel setNumberOfLines:0];
msgLabel.lineBreakMode = UILineBreakModeWordWrap;
UIFont *fonts = [UIFont fontWithName:@"Arial" size:12];
msgLabel.font = fonts;
CGSize size = CGSizeMake(290, 1000);
msgLabel.text = @"获取到的deviceToken,我们可以通过webservice服务提交给.net应用程序,这里我简单处理,直接打印出来,拷贝到.net应用环境中使用。";
CGSize msgSie = [msgLabel.text sizeWithFont:fonts constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap];
[msgLabel setFrame:CGRectMake(15, 45, 290, msgSie.height)];
UILabel根据字数多少自动实现适应高度
最新推荐文章于 2024-08-26 08:10:44 发布