Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

UITableViewController ImageView not displaying until cell is touched

$
0
0

I'm working with trying to display fill the ImageView in my UITableViewController. The following is my GetCell. Unfortunately, the image does get displayed unless I touch the row. Once I touch the row, then the image displays. I think that I need to tell the cell that there is an actual image to display. Is there any way to do this within the GetCell code? Any suggestions are appreciated.

    public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
    {
        var cell = tableView.DequeueReusableCell ("whitelist") as UITableViewCell;
        if (cell == null)
            cell = new UITableViewCell (UITableViewCellStyle.Subtitle, "whitelist");

        var user = whList [indexPath.Row];
        cell.TextLabel.Text = user.ScreenName;
        cell.DetailTextLabel.Text = String.Format ("Ers:{0} Ing:{1} J:{2}", 
            user.FollowerCount, user.FollowingCount, user.DateOnTwitter.ToShortDateString());
            var hc = new HttpClient();
        hc.GetByteArrayAsync(user.Image).ContinueWith((task) => {
            InvokeOnMainThread(delegate{
                var data = task.Result;
                cell.ImageView.Image = UIImage.LoadFromData(NSData.FromArray(data));
            });
        });
        return cell;
    }
}

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>