0

UITablViewSource で以下のコードを使用しています

 public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
 {
 UIImage scaledImage=null;
string cellIdentifier = "NewsFeedCell"; 
var newsFeedCellItem = NewsFeedCellItemList [indexPath.Row];    
var newsFeedCell = new NewsFeedCell (NewsFeedScreenInstance, newsFeedCellItem,       cellIdentifier, indexPath);

if (newsFeedCell != null) {
 if (!String.IsNullOrWhiteSpace (newsFeedCellItem.FeedItem.Picture.PreviewUrl)) {
                var image = ImageStore.Get      (newsFeedCellItem.FeedItem.Picture.PreviewUrl);
                if(image != null)
                {
                    newsFeedCellItem.FeedItem.Picture.Image = image;
                    scaledImage = ImageHelper.Scale(image, new SizeF (528, 528));
                }
                if (scaledImage != null) {
                    newsFeedCell.ScrapImage = scaledImage;
                } else {
                    BeginDownloadImage (tableView, indexPath);
                }

            }


        }

        return newsFeedCell;
    }

    #endregion

    #region PRIVATE METHODS

    private void BeginDownloadImage (UITableView tableView, NSIndexPath indexPath)
    {
        Action successAction = () => {

            this.BeginInvokeOnMainThread (() => {
                tableView.BeginUpdates ();
                tableView.ReloadRows (new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
                tableView.EndUpdates ();
            });
        };

        ImageStore.BeginDownloadImage(NewsFeedCellItemList [indexPath.Row].FeedItem.Picture.PreviewUrl, successAction);
    }
    #endregion

*説明: *しかし、コードの下の部分で例外が発生しています。

* -[Scrapboom.iPhone.NewsFeedTableView _endCellAnimationsWithContext:]、/SourceCache/UIKit/UIKit-2903.2/UITableView.m:1076 でアサーション エラーが発生し、アプリケーションがハングするか、場合によってはクラッシュします。

tableView.ReloadRows (new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
4

1 に答える 1