UILable 自适应长度

来源:互联网 发布:php基本语法 编辑:程序博客网 时间:2024/06/06 03:43
//Calculate the size necessary for the UILableNSString *theText = @"Texting";CGSize theStringSize = [theText sizeWithFont:font     constrainedToSize:theLabel.frame.size    lineBreakMode:theLabel.lineBreakMode];//Adjust the size of the UILabletheLable.frame = CGRectMake(theLable.frame.origin.x,     theLable.frame.origin.y,     theStringSize.width, theStringSize.height);theLable.text = theText;
0 0
原创粉丝点击