我有一组评论,但我只想显示5条评论。 点击加载时,我想显示更多5条评论+ 5条新评论。
从api获取评论
if let arr : NSArray = responseData as? NSArray {
self?.arrComments = NSMutableArray()
if arr.count != 0{
self?.arrComments = arr.mutableCopy() as? NSMutableArray ?? []
self?.tblView.reloadData()
}
}
出队tableView单元格
if arrComments.count != 0 {
if let myDict: NSDictionary = arrComments.object(at: indexPath.row) as? NSDictionary {
cell.lblComment.text = string(myDict, "Comment")
cell.lblTime.text = string(myDict, "CommentDate")