ArcGISRuntimeXamarin.Samples.ChangeSublayerVisibility.SublayerDataSource.GetCell C# (CSharp) Method

GetCell() public method

public GetCell ( UITableView tableView, NSIndexPath indexPath ) : UITableViewCell
tableView UITableView
indexPath NSIndexPath
return UITableViewCell
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            // Create the cells in the table
            var cell = new UITableViewCell(UITableViewCellStyle.Default, CELL_ID);

            var sublayer = sublayers[indexPath.Row] as ArcGISMapImageSublayer;
            cell.TextLabel.Text = sublayer.Name;

            // Create a UISwitch for controlling the layer visibility
            var visibilitySwitch = new UISwitch()
            {
                Frame = new CoreGraphics.CGRect(cell.Bounds.Width - 60, 7, 50, cell.Bounds.Height)
            };
            visibilitySwitch.Tag = indexPath.Row;
            visibilitySwitch.On = sublayer.IsVisible;
            visibilitySwitch.ValueChanged += VisibilitySwitch_ValueChanged;

            // Add the UISwitch to the cell's content view
            cell.ContentView.AddSubview(visibilitySwitch);

            return cell;
        }