What is the meaning of the “no index path for table cell being reused” message in iOS 6/7?

前端 未结 14 2281
一整个雨季
一整个雨季 2020-11-27 15:12

Since starting to compile my app with iOS 6 (and since also iOS 7) I\'ve started seeing this message. I know that the way that UITableViews go about managing cells is diffe

14条回答
  •  余生分开走
    2020-11-27 15:43

    As an addition to my previous post (in which I mentioned that this was apparently a bug with UIKit), I was able to find a workaround for my particular case (in which the message was related to some strange visualisation glitches on the table).

    Apparently my custom cell's overridden -(void)setEditing:animated: was taking too long to return.

    My previous code was:

    - (void)setEditing:(BOOL)editing animated:(BOOL)animated
    {   
        [super setEditing:editing animated:animated];
        [self someAdditionalCode];
    }
    

    I was able to fix it by changing it to:

    - (void)setEditing:(BOOL)editing animated:(BOOL)animated
    {   
        [super setEditing:editing animated:animated];
    
        // DRM: we want to perform the actions from this block in the main thread, but
        // asynchronously to avoid excessive delays which were causing issues.
        //
        dispatch_async(dispatch_get_main_queue(), ^void()
        {
            [self someAdditionalCode];
        });
    }
    

提交回复
热议问题