English 中文(简体)
A. 逐条增长的最新情况
原标题:Update number of rows in section asynchronously

I ve been getting a table view inconsistency exception, wanting to know a way around it. Tapping on a table view cell accessory view, I display an additional cell in the table view, think of a control panel popping below the row you re looking at. Meanwhile, an HTTP request to an API is fetching the second page of data.. if the data comes in while I m animating the control panel, I get the crash.

NSInternalInconsistencyException , reason: Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (31) must be equal to the number of rows contained in that section before the update (32), plus or minus the number of rows inserted or deleted from that section (1 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).

最佳回答

Solved! Turned out the issue wasn t in the content updates directly. I was adding a row in numberOfRowsInSection like so:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {   
    NSInteger count = [self.sharedItems count];
    if (_contentPagesTotal > _contentPagesLoaded) {
        // Add a row for the loading label
        count++;
    }
    return count;
}

现在

if (self.showLoadingRow) {
    count ++
}

And in the content http callback: self.showLoadingRow = _contentPagesTotal > _contentPagesLoaded

因此,装货箱在装货时被 stick。

问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签