Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func nodeLoaded(node: NSMutableDictionary) {
- for var i = 0; i < nodesArray.count; ++i {
- if ((nodesArray[i]["id"] as! Int) == (node["id"] as! Int)) {
- nodesArray[i] = node
- table.reloadRowsAtIndexPaths([NSIndexPath(forRow: i, inSection: 0)], withRowAnimation: UITableViewRowAnimation.None) // Скролит наверх из-за
- }
- }
- }
- override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
- var cell: NewsCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! NewsCell
- var node = nodesArray[indexPath.row] as! NSDictionary
- if (node["needLoad"] as! Bool) {
- dbHelper.getNode(node["id"] as! Int, hash: node["id"] as! Int, tableName: DbHelper.newsTableName, callback: self)
- } else {
- cell.id = node["id"] as! Int
- cell.titleLabel.text = node["title"] as? String
- cell.descriptionLabel.text = node["description"] as? String
- cell.imgView.image = WorkWithImage.loadImageFromSD((node["image"] as! String))
- }
- return cell
- }
- func nodeLoaded(node: NSMutableDictionary) {
- for var i = 0; i < nodesArray.count; ++i {
- if ((nodesArray[i]["id"] as! Int) == (node["id"] as! Int)) {
- nodesArray[i] = node
- if var cell = table.cellForRowAtIndexPath(NSIndexPath(forRow: i, inSection: 0)) as? NewsCell {
- cell.titleLabel.text = node["title"] as? String
- cell.descriptionLabel.text = node["description"] as? String
- cell.imgView.image = WorkWithImage.loadImageFromSD((node["image"] as! String))
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement