Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. func nodeLoaded(node: NSMutableDictionary) {
  2. for var i = 0; i < nodesArray.count; ++i {
  3. if ((nodesArray[i]["id"] as! Int) == (node["id"] as! Int)) {
  4. nodesArray[i] = node
  5. table.reloadRowsAtIndexPaths([NSIndexPath(forRow: i, inSection: 0)], withRowAnimation: UITableViewRowAnimation.None) // Скролит наверх из-за
  6. }
  7. }
  8. }
  9.  
  10. override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
  11. var cell: NewsCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! NewsCell
  12. var node = nodesArray[indexPath.row] as! NSDictionary
  13. if (node["needLoad"] as! Bool) {
  14. dbHelper.getNode(node["id"] as! Int, hash: node["id"] as! Int, tableName: DbHelper.newsTableName, callback: self)
  15. } else {
  16. cell.id = node["id"] as! Int
  17. cell.titleLabel.text = node["title"] as? String
  18. cell.descriptionLabel.text = node["description"] as? String
  19. cell.imgView.image = WorkWithImage.loadImageFromSD((node["image"] as! String))
  20. }
  21. return cell
  22. }
  23.  
  24. func nodeLoaded(node: NSMutableDictionary) {
  25. for var i = 0; i < nodesArray.count; ++i {
  26. if ((nodesArray[i]["id"] as! Int) == (node["id"] as! Int)) {
  27. nodesArray[i] = node
  28. if var cell = table.cellForRowAtIndexPath(NSIndexPath(forRow: i, inSection: 0)) as? NewsCell {
  29. cell.titleLabel.text = node["title"] as? String
  30. cell.descriptionLabel.text = node["description"] as? String
  31. cell.imgView.image = WorkWithImage.loadImageFromSD((node["image"] as! String))
  32. }
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement