protected override UITableViewCell GetOrCreateCellFor(UITableView tableView, NSIndexPath indexPath, object item) { var cell = tableView.DequeueReusableCell(TaskCell.Key) as TaskCell; if (cell == null) { cell = TaskCell.Create(); } cell.ViewModel = item as TaskItemViewModel; cell.UserInteractionEnabled = cell.ViewModel.Enabled; cell.Accessory = cell.ViewModel.IsShowPleaseWait ? UITableViewCellAccessory.None : (cell.ViewModel.Finished ? UITableViewCellAccessory.Checkmark : (cell.ViewModel.Enabled ? UITableViewCellAccessory.DisclosureIndicator: UITableViewCellAccessory.None)); //cell.ContentView.BackgroundColor = cell.ViewModel.Finished ? UIColor.FromRGB(31,31,31) : (cell.ViewModel.Enabled ? UIColor.FromRGB(31,31,31) : UIColor.DarkGray); cell.title.TextColor = cell.ViewModel.Finished ? UIColor.White : (cell.ViewModel.Enabled ? UIColor.White : UIColor.DarkGray); //set image for cell switch (indexPath.Row) { case 0: cell.Icon.Image = UIImage.FromFile("blue_icon_home.png"); break; case 1: cell.Icon.Image = UIImage.FromFile("blue_icon_navigate.png"); break; case 2: cell.Icon.Image = UIImage.FromFile("blue_icon_chart.png"); break; case 3: cell.Icon.Image = UIImage.FromFile("blue_icon_location.png"); break; case 4: cell.Icon.Image = UIImage.FromFile("blue_icon_car.png"); break; case 5: cell.Icon.Image = UIImage.FromFile("blue_icon_euro.png"); break; case 6: cell.Icon.Image = UIImage.FromFile("blue_icon_calendar.png"); break; } return(cell); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell(CellIdentifier) as TaskCell; var task = this.tasks[indexPath.Row]; if (cell == null) { cell = new TaskCell(CellIdentifier); } cell.UpdateTask(task); return cell; }
static void SetTaskCompleteStatus(TaskCell taskCell, UILabel taskName, UILabel categoryName, UIImageView categoryIcon) { if (taskCell.IsDone) { taskName.TextColor = UIColor.LightGray; taskName.AttributedText = new NSAttributedString(taskCell.Title, new UIStringAttributes { StrikethroughStyle = NSUnderlineStyle.Single }); categoryName.TextColor = UIColor.LightGray; categoryIcon.Image = ImageHelper.GrayscaleImage(new UIImage(taskCell.CategoryIcon)); } else { taskName.Text = taskCell.Title; } }
static void SetTaskCompleteStatus(TaskCell taskCell, UILabel taskName, UILabel categoryName, UIImageView categoryIcon) { if (taskCell.IsDone) { taskName.TextColor = UIColor.LightGray; taskName.AttributedText = new NSAttributedString (taskCell.Title, new UIStringAttributes { StrikethroughStyle = NSUnderlineStyle.Single }); categoryName.TextColor = UIColor.LightGray; categoryIcon.Image = ImageHelper.GrayscaleImage (new UIImage (taskCell.CategoryIcon)); } else taskName.Text = taskCell.Title; }