在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
let label = UILabel.init() label.backgroundColor = UIColor.grayColor() label.text = "1234567890-edfdgddffgfgfggfggddfbyfru6y6r7iuymgnjnrtfugyu57t6injyunjokn89uilmghbjl,hknjlllllllllllllllllllllllllllllllllllllmimomomkjnijunbuygbtyfrtdrxcresxweaswa" label.font = UIFont.systemFontOfSize(14 ) label.textColor = UIColor.redColor() let string:NSString = label.text! let options:NSStringDrawingOptions = .UsesLineFragmentOrigin let boundingRect = string.boundingRectWithSize(CGSizeMake(200, 0), options: options, attributes:[NSFontAttributeName:label.font], context: nil) label.frame = CGRectMake(0, 20, 200, boundingRect.height) label.numberOfLines = 0; label.lineBreakMode = NSLineBreakMode.ByWordWrapping self.view.addSubview(label)
|
请发表评论