Esempio n. 1
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                var ident = "DefaultCell";

                if (indexPath.Section == 3)
                {
                    ident = "SwitchCell";
                }

                var cell = tableView.DequeueReusableCell(ident);

                if (cell == null)
                {
                    cell = new UITableViewCell(UITableViewCellStyle.Default, ident);
                }

                if (indexPath.Section == 3)
                {
                    var fsSwitch = new UISwitch();
                    fsSwitch.SizeToFit();
                    fsSwitch.On            = _dvc.useFixedSize;
                    fsSwitch.ValueChanged += delegate {
                        _dvc.useFixedSize = fsSwitch.On;
                        if (_dvc.useFixedSize)
                        {
                            _dvc.hud.SetFixedSize(new SizeF(200, 100));
                        }
                        else
                        {
                            _dvc.hud.SetFixedSize(SizeF.Empty);
                        }
                    };
                    cell.AccessoryView = fsSwitch;

                    cell.Accessory      = UITableViewCellAccessory.None;
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                }
                else
                {
                    cell.AccessoryView  = null;
                    cell.Accessory      = UITableViewCellAccessory.DisclosureIndicator;
                    cell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
                }

                cell.TextLabel.Text = _dvc.cellCaptions[indexPath.Section][indexPath.Row];

                return(cell);
            }
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                var ident = "DefaultCell";
                if (indexPath.Section == 3) {
                    ident = "SwitchCell";
                }

                var cell = tableView.DequeueReusableCell(ident);

                if (cell == null)
                    cell = new UITableViewCell(UITableViewCellStyle.Default, ident);

                if (indexPath.Section == 3) {

                    var fsSwitch = new UISwitch();
                    fsSwitch.SizeToFit();
                    fsSwitch.On = _dvc.useFixedSize;
                    fsSwitch.ValueChanged += delegate {
                        _dvc.useFixedSize = fsSwitch.On;
                        if (_dvc.useFixedSize)
                            _dvc.hud.SetFixedSize(new SizeF(200, 100));
                        else
                            _dvc.hud.SetFixedSize(SizeF.Empty);
                    };
                    cell.AccessoryView = fsSwitch;

                    cell.Accessory = UITableViewCellAccessory.None;
                    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                } else {
                    cell.AccessoryView = null;
                    cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                    cell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
                }

                cell.TextLabel.Text = _dvc.cellCaptions[indexPath.Section][indexPath.Row];

                return cell;
            }