RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
iOSUILabel设置行高-创新互联

UILabel *tileLabel = [[UILabel alloc] init];

目前创新互联公司已为上千多家的企业提供了网站建设、域名、网页空间、网站运营、企业网站设计、沙湾网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

  tileLabel.numberOfLines = 0;

  tileLabel.backgroundColor = [UIColor clearColor];

  tileLabel.text = @"调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头调整行间距云头";

  tileLabel.font = [UIFont systemFontOfSize:11.0f];

  tileLabel.textColor = [Tools colorWithHex:0x787878];

  NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:tileLabel.text];

  NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];

  [paragraphStyle setLineSpacing:18];//调整行间距

  [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [tileLabel.text length])];

  tileLabel.attributedText = attributedString;

  NSDictionary *attributes = @{NSFontAttributeName:tileLabel.font, NSParagraphStyleAttributeName:paragraphStyle.copy};

  CGFloat height = [tileLabel.text boundingRectWithSize:CGSizeMake(self.view.width-32, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attributes context:nil].size.height ;

//  CGFloat height =[self changeStationWidth:tileLabel.text anWidthTxtt:self.view.width-32 anfont:11];

  tileLabel.frame = CGRectMake(16, 0, self.view.width-32, height);

  [self.view addSubview:tileLabel];

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


当前名称:iOSUILabel设置行高-创新互联
转载来源:http://sczitong.cn/article/dddcos.html