コード例 #1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = Controller.Model.GetCell(indexPath.Section, indexPath.Row);

            var nativeCell = CellTableViewCell.GetNativeCell(tableView, cell);

            return(nativeCell);
        }
コード例 #2
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                UITableViewCell nativeCell = null;

                var cachingStrategy = Controller.CachingStrategy;

                if (cachingStrategy == ListViewCachingStrategy.RetainElement)
                {
                    var cell = GetCellForPath(indexPath);
                    nativeCell = CellTableViewCell.GetNativeCell(tableView, cell);
                }
                else if (cachingStrategy == ListViewCachingStrategy.RecycleElement)
                {
                    var id = TemplateIdForPath(indexPath);
                    nativeCell = tableView.DequeueReusableCell(ContextActionsCell.Key + id);
                    if (nativeCell == null)
                    {
                        var cell = GetCellForPath(indexPath);
                        nativeCell = CellTableViewCell.GetNativeCell(tableView, cell, true, id.ToString());
                    }
                    else
                    {
                        var             templatedList = TemplatedItemsView.TemplatedItems.GetGroup(indexPath.Section);
                        var             cell          = (Cell)((INativeElementView)nativeCell).Element;
                        ICellController controller    = cell;
                        controller.SendDisappearing();
                        templatedList.UpdateContent(cell, indexPath.Row);
                        controller.SendAppearing();
                    }
                }
                else
                {
                    throw new NotSupportedException();
                }

                var bgColor = tableView.IndexPathForSelectedRow != null && tableView.IndexPathForSelectedRow.Equals(indexPath) ? UIColor.Clear : DefaultBackgroundColor;

                SetCellBackgroundColor(nativeCell, bgColor);

                return(nativeCell);
            }