Example #1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewCell cell      = tableView.DequeueReusableCell(cellIdentifier);
            var             cellStyle = UITableViewCellStyle.Value1;

            if (cell == null)
            {
                cell = new UITableViewCell(cellStyle, cellIdentifier);
            }
            cell.TextLabel.Text = tableItems[indexPath.Row].VacationType;
            if (cellStyle == UITableViewCellStyle.Subtitle ||
                cellStyle == UITableViewCellStyle.Value1 ||
                cellStyle == UITableViewCellStyle.Value2)
            {
                cell.DetailTextLabel.Text = tableItems[indexPath.Row].Date;
                if (tableItems[indexPath.Row].Status.Equals(VacationStatus.Approved.ToString()))
                {
                    cell.DetailTextLabel.TextColor = UIColor.Green;
                }
                else
                {
                    if (tableItems[indexPath.Row].Status.Equals(VacationStatus.Rejected.ToString()))
                    {
                        cell.DetailTextLabel.TextColor = UIColor.Red;
                    }
                    else
                    {
                        cell.DetailTextLabel.TextColor = UIColor.Gray;
                    }
                }
            }
            if (cellStyle != UITableViewCellStyle.Value2)
            {
                cell.ImageView.Image = UIImage.FromFile("Images/person.png");
            }
            cell.Accessory            = UITableViewCellAccessory.DisclosureIndicator;
            cell.DetailTextLabel.Font = FontLoader.GetFontSmall();
            cell.TextLabel.Font       = FontLoader.GetFontBold();
            return(cell);
        }