在我的自定义UITableViewController
中,viewDidLoad()
我设置了tableView.estimatedRowHeight = 300
和tableView.rowHeight = UITableViewAutomaticDimension
然后当我调用tableView.reloadRowsAtIndexPaths
时,contentoffset发生了变化,我该如何解决?谢谢!
tableView.estimatedRowHeight = 300
tableView.rowHeight = UITableViewAutomaticDimension
tableView.registerNib(UINib(nibName:"PostCell", bundle: nil), forCellReuseIdentifier: "PostCell")
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "PunchCardCell")
func handlePostChange(notification: NSNotification) {
if let object = notification.object as? Post {
for (index, post) in posts.enumerate() {
if post.objectId == object.objectId {
if let userInfo = notification.userInfo {
post.setValuesForKeysWithDictionary(userInfo as! [String : AnyObject])
}
let indexPath = NSIndexPath(forRow: index, inSection: 0)
tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: .None)
break
}
}
}
}