/// <summary> /// Called by the TableView to get the actual UITableViewCell to render for the particular section and row /// </summary> public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) { //---- declare vars UITableViewCell cell = tableView.DequeueReusableCell(this._cellIdentifier); //---- if there are no cells to reuse, create a new one if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, this._cellIdentifier); } //---- create a shortcut to our item BasicTableViewItem item = this._tableItems[indexPath.Section].Items[indexPath.Row]; cell.TextLabel.Text = item.Movie.title; if (!string.IsNullOrEmpty(item.Movie.thumbNail)) { MonoTouch.Foundation.NSUrl nsUrl = new MonoTouch.Foundation.NSUrl(item.Movie.thumbNail); MonoTouch.Foundation.NSData data = MonoTouch.Foundation.NSData.FromUrl(nsUrl); var myImage = new UIImage(data); cell.ImageView.Image = myImage; } return(cell); }
public static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream) { MonoTouch.Foundation.NSData nsData = MonoTouch.Foundation.NSData.FromStream(textureStream); UIImage image = UIImage.LoadFromData(nsData); if (image == null) { throw new ContentLoadException("Error loading Texture2D Stream"); } ESImage theTexture = new ESImage(image, graphicsDevice.PreferedFilter); Texture2D result = new Texture2D(theTexture); return(result); }
/// <summary> /// Called by the TableView to get the actual UITableViewCell to render for the particular section and row /// </summary> public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) { //---- declare vars UITableViewCell cell = tableView.DequeueReusableCell(this._customCellIdentifier); CustomCell customCellController = null; //---- if there are no cells to reuse, create a new one if (cell == null) { customCellController = new CustomCell(); // retreive the cell from our custom cell controller cell = customCellController.Cell; // give the cell a unique ID, so we can match it up to the controller cell.Tag = Environment.TickCount; // store our controller with the unique ID we gave our cell this._cellControllers.Add(cell.Tag, customCellController); } else { // retreive our controller via it's unique ID customCellController = this._cellControllers[cell.Tag]; } //---- create a shortcut to our item BasicTableViewItem item = this._tableItems[indexPath.Section].Items[indexPath.Row]; //---- set our cell properties customCellController._CriticScore = item.Movie.CriticScore; customCellController._Title = item.Movie.Title; customCellController._Indicator = item.Movie.FanIndicator; customCellController._Mpaa = item.Movie.MPAA; customCellController._RunTime = item.Movie.RunTime; customCellController._Actors = item.Movie.AbridgedActors; if (!string.IsNullOrEmpty(item.Movie.ThumbNail)) { MonoTouch.Foundation.NSUrl nsUrl = new MonoTouch.Foundation.NSUrl(item.Movie.ThumbNail); MonoTouch.Foundation.NSData data = MonoTouch.Foundation.NSData.FromUrl(nsUrl); var myImage = new UIImage(data); customCellController._Thumbnail.Image = myImage; } return(cell); }