当前位置: 首页>>代码示例>>C#>>正文


C# UITableView.ReloadCellModel方法代码示例

本文整理汇总了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" }
            ));

//.........这里部分代码省略.........
开发者ID:sebbarg,项目名称:yagnix,代码行数:101,代码来源:YxTableController.cs


注:本文中的UITableView.ReloadCellModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。