本文整理汇总了C#中UITableView.ReloadCellModel方法的典型用法代码示例。如果您正苦于以下问题:C# UITableView.ReloadCellModel方法的具体用法?C# UITableView.ReloadCellModel怎么用?C# UITableView.ReloadCellModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITableView
的用法示例。
在下文中一共展示了UITableView.ReloadCellModel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.BackgroundColor = UIColor.Green;
Title = "YxTableTest";
_view = new UITableView(new CGRect(), UITableViewStyle.Grouped);
View.Add(_view);
//_view.SeparatorInset = UIEdgeInsets.Zero;
//_view.LayoutMargins = UIEdgeInsets.Zero;
//_view.SeparatorStyle = UITableViewCellSeparatorStyle.None;
_view.FitToParent();
var source = new TableSource();
Section section;
// -----------------------
section = new Section();
section.Header = "Default cell";
section.Footer = "---";
var defaultCellFactory = new DefaultCellFactory();
section.Cells.Add(
new CellModel<ItemWithTitle>(
defaultCellFactory,
new ItemWithTitle { Title = "foo" }
));
section.Cells.Add(
new CellModel<ItemWithTitle>(
defaultCellFactory,
new ItemWithTitle { Title = "bar" }
));
source.Sections.Add(section);
// -----------------------
section = new Section();
section.Header = "Subtitle";
section.Cells.Add(
new CellModel<ItemWithTitleAndSubtitle>(
Singleton<SubtitleCellFactory>._,
new ItemWithTitleAndSubtitle { Title = "abc", SubTitle = "123" }
));
source.Sections.Add(section);
// -----------------------
section = new Section();
section.Header = "Switch cell";
var changingModel = new ItemWithTitle { Title = "This will change when switch is toggled" };
var changingCell = new CellModel<ItemWithTitle>(defaultCellFactory, changingModel);
section.Cells.Add( changingCell );
var switchCellFactory1 = new SwitchCellFactory { InitialState = true };
var switchCellFactory2 = new SwitchCellFactory {
InitialState = false,
CellSelected = (cell) => MsgBox.Show(cell.Model.Title, "Cell selected", new [] {"OK"}),
Toggled = (cell) => {
changingCell.Model.Title = "You changed me!";
_view.ReloadCellModel(changingCell);
}
};
section.Cells.Add(
new CellModel<ItemWithTitle>(
switchCellFactory1,
new ItemWithTitle { Title = "foo" }
));
section.Cells.Add(
new CellModel<ItemWithTitle>(
switchCellFactory2,
new ItemWithTitle { Title = "Toggling this will change above text. Hopafully." }
));
source.Sections.Add(section);
// -----------------------
section = new Section();
section.Header = "Custom 1";
section.Cells.Add(
new CellModel<ItemWithTitle>(
Singleton<CustomCellFactory1>._,
new ItemWithTitle { Title = "abc" }
));
//.........这里部分代码省略.........