Xamarin.iOS UITableView,如何强制单元格更新? [英] Xamarin.iOS UITableView, how do you force a cell to update?

查看:25
本文介绍了Xamarin.iOS UITableView,如何强制单元格更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Xamarin.iOS,但无法弄清楚如何更新单个单元格.在 WPF ListView 中,我可以做一个绑定,让单元格的属性做一个 inotifypropertychanged,它会通过绑定自动发生.Xamarin.iOS 中是否有一些等效的功能?更新 UITableView 单元格而不只是擦除它们并重新添加它们似乎非常麻烦..

I am using Xamarin.iOS and cannot figure out how to update a single cell. In WPF ListView, I can just do a binding and have the cell's properties do an inotifypropertychanged and it automatically happens through the binding. Is there some equivalent functionality in Xamarin.iOS? It seems super cumbersome to update UITableView cells without just wiping them out and re-adding them..

更新单个单元格的最佳方法是什么?

What is the best way to update individual cells?

推荐答案

假设您的 UITableView 存储在tableView"变量中:

Assuming your UITableView is stored in a "tableView" variable:

NSIndexPath[] rowsToReload = new NSIndexPath[] {
    NSIndexPath.FromRowSection(1, 0) // points to second row in the first section of the model
};
tableView.ReloadRows(rowsToReload, UITableViewCellRowAnimation.None);

这篇关于Xamarin.iOS UITableView,如何强制单元格更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆