예제 #1
0
        public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
        {
            int section = indexPath.Section;
            int row     = indexPath.Row;

            switch (section)
            {
            case (int)Section.Icon:
                if (iconCell == null)
                {
                    iconCell = (TTTProfileIconTableViewCell)cell;
                    iconCell.SegmentedControl.ValueChanged += ChangeIcon;
                }

                iconCell.SelectionStyle = UITableViewCellSelectionStyle.None;
                iconCell.SegmentedControl.SelectedSegment = (int)Profile.Icon;
                break;

            case (int)Section.Statistics:
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                if (row == 0)
                {
                    cell.TextLabel.Text  = "Victories";
                    cell.ImageView.Image = UIImage.FromBundle("victory").
                                           ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                    ((TTTProfileStatisticsTableViewCell)cell).CountView.Count =
                        Profile.NumberOfGamesWithResult(TTTGameResult.Victory);
                }
                else if (row == 1)
                {
                    cell.TextLabel.Text  = "Defeats";
                    cell.ImageView.Image = UIImage.FromBundle("defeat").
                                           ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                    ((TTTProfileStatisticsTableViewCell)cell).CountView.Count =
                        Profile.NumberOfGamesWithResult(TTTGameResult.Defeat);
                }
                else if (row == 2)
                {
                    cell.TextLabel.Text  = "Draws";
                    cell.ImageView.Image = UIImage.FromBundle("draw").
                                           ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                    ((TTTProfileStatisticsTableViewCell)cell).CountView.Count =
                        Profile.NumberOfGamesWithResult(TTTGameResult.Draw);
                }
                break;

            case (int)Section.History:
                cell.TextLabel.Text          = "Show History";
                cell.TextLabel.TextAlignment = UITextAlignment.Center;
                break;
            }
        }
		public override void WillDisplay (UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
		{
			int section = indexPath.Section;
			int row = indexPath.Row;

			switch (section) {
			case (int)Section.Icon:
				if (iconCell == null) {
					iconCell = (TTTProfileIconTableViewCell)cell;
					iconCell.SegmentedControl.ValueChanged += ChangeIcon;
				}

				iconCell.SelectionStyle = UITableViewCellSelectionStyle.None;
				iconCell.SegmentedControl.SelectedSegment = (int)Profile.Icon;
				break;
			case (int)Section.Statistics:
				cell.SelectionStyle = UITableViewCellSelectionStyle.None;
				if (row == 0) {
					cell.TextLabel.Text = "Victories";
					cell.ImageView.Image = UIImage.FromBundle ("victory").
						ImageWithRenderingMode (UIImageRenderingMode.AlwaysTemplate);
					((TTTProfileStatisticsTableViewCell)cell).CountView.Count =
						Profile.NumberOfGamesWithResult (TTTGameResult.Victory);
				} else if (row == 1) {
					cell.TextLabel.Text = "Defeats";
					cell.ImageView.Image = UIImage.FromBundle ("defeat").
						ImageWithRenderingMode (UIImageRenderingMode.AlwaysTemplate);
					((TTTProfileStatisticsTableViewCell)cell).CountView.Count =
						Profile.NumberOfGamesWithResult (TTTGameResult.Defeat);
				} else if (row == 2) {
					cell.TextLabel.Text = "Draws";
					cell.ImageView.Image = UIImage.FromBundle ("draw").
						ImageWithRenderingMode (UIImageRenderingMode.AlwaysTemplate);
					((TTTProfileStatisticsTableViewCell)cell).CountView.Count =
						Profile.NumberOfGamesWithResult (TTTGameResult.Draw);
				}
				break;
			case (int)Section.History:
				cell.TextLabel.Text = "Show History";
				cell.TextLabel.TextAlignment = UITextAlignment.Center;
				break;
			}
		}