swift uitableview显示cell最后一列

前端之家收集整理的这篇文章主要介绍了swift uitableview显示cell最后一列前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

类似qq聊天的效果。每发一条信息,tableview更新cell并且显示最后一个cell


  1. func tableView(tableView: UITableView,cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
  2. let cell = tableView.dequeueReusableCellWithIdentifier("cell") as! UITableViewCell
  3.  
  4. var sectionCount:Int = self.tableViewMessInfo.numberOfSections()
  5. if(sectionCount != 0) {
  6. var rowCount = self.tableViewMessInfo.numberOfRowsInSection(0)
  7. if(rowCount != 0)
  8. {
  9. println("\\\\\\\\\\\\\\\\\\")
  10. var ii = [0,rowCount - 1]
  11. var indexPath = NSIndexPath(indexes: ii,length: ii.count)
  12. self.tableViewMessInfo.scrollToRowAtIndexPath(indexPath,atScrollPosition: UITableViewScrollPosition.Bottom,animated: true)
  13. }
  14. }
  15. return cell
  16. }

猜你在找的Swift相关文章