public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) { var item = parent.data[indexPath.Row]; string text = item.title; if (item.release_date.HasValue) { text += " (" + item.release_date.Value.Year.ToString() + ")"; } var cell = tableView.DequeueReusableCell(MovieCell.Identifier) as MovieCell; if (cell == null) { cell = new MovieCell(text, null, item.poster_path, tableView); } cell.UpdateUI(); return(cell); }
public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) { var movie = parent._data; UITableViewCell cell = null; if (indexPath.Section == 0) { var c = new MovieCell(movie.title, movie.overview, movie.poster_path, tableView); c.UpdateUI(); cell = c; } else if (indexPath.Section == 1) { if (parent._cast.cast.Count >= 3 && indexPath.Row == 3) { cell = new UITableViewCell(UITableViewCellStyle.Default, "cell"); cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; cell.TextLabel.Text = "All cast"; } else { var person = parent._cast.cast[indexPath.Row]; cell = new UITableViewCell(UITableViewCellStyle.Subtitle, "cell"); cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; cell.TextLabel.Text = person.name; cell.DetailTextLabel.Text = person.character; cell.ImageView.Image = ImageLoader.DefaultRequestImage(Constants.GetImageUrl(person.profile_path), this); } } else if (indexPath.Section == 2) { if (indexPath.Row == 0) { cell = GetInfoCell("Genres", movie.genres.JoinStrings(g => g.name, ", ")); } else if (indexPath.Row == 1) { cell = GetInfoCell("Budget", movie.budget.ToString()); } else if (indexPath.Row == 2) { cell = GetInfoCell("Home Page", movie.homepage); } else if (indexPath.Row == 3) { cell = GetInfoCell("Go to Imdb", "", true); } else if (indexPath.Row == 4) { cell = GetInfoCell("Popularity", movie.popularity.ToString()); } else if (indexPath.Row == 5) { cell = GetInfoCell("Companies", movie.production_companies.JoinStrings(c => c.name, ", ")); } else if (indexPath.Row == 6) { cell = GetInfoCell("Countries", movie.production_countries.JoinStrings(c => c.name, ", ")); } else if (indexPath.Row == 7) { cell = GetInfoCell("Revenue", movie.revenue.ToString()); } else if (indexPath.Row == 8) { cell = GetInfoCell("Runtime", movie.runtime.ToString()); } } else { throw new NotSupportedException("section"); } return(cell); }