自适应

作者: 法库德 | 来源:发表于2018-01-17 10:03 被阅读0次

overridefunc viewDidLoad() 

{ super.viewDidLoad() self.tableView.estimatedRowHeight =100

    self.tableView.rowHeight = UITableViewAutomaticDimension

}


func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell

 {

            cell.textLabel?.numberOfLines =0 

            cell.textLabel?.preferredMaxLayoutWidth= CGRectGetWidth(tableView.bounds) 

}

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat 

{

    return UITableViewAutomaticDimension

}

相关文章

网友评论

      本文标题:自适应

      本文链接:https://www.haomeiwen.com/subject/nruyoxtx.html