uitableview - In an iOS table view, how should a row be moved to a new section? -
I have a table view with two lines in a row, that is
- - Line one line B If I want to enlarge line 1 in a new section, i.e. the end result:
--- B - - RA A How should it be obtained? I've already tried:
[self.tableView startupdates]; [Self.tableView deleteRowsAtIndexPaths: @ [[NSINX XPath IndexPathForRO: 0Injection: 0]] With ROOAnation: UITWebViewAvisionNonone]; [Self.tableView insertSections: [NSIndexSet IndexSetWithIndex: 1] withRowAnimation: UITableViewRowAnimationNone]; [Self.tableView and Updates]; However, at least in iOS 8, the line is animated out, but then the new volume without any render (i.e. white, no bottom row limit) until some time until no restructuring starts And it comes back. [self.tableView startupdates]; [Self-TaleviewViewLavroATAndApath: [NSINXPath indexPathForRo: 0Injection: 0] to INDICAPPATH: [NSINXXPath indexPathForRO: 0 in size: 1]]; [Self.tableView and Updates]; which increases the exception:
Invalid update: Invalid number of sections Update (2) after the number of sections included in the table view (1 ) Before the table should be equal to the number of sections contained in the view, plus or minus the number of sections or inserted (0 is inserted, 0). and:
[self.tableView startupdates]; [Self.tableView insertSections: [NSIndexSet IndexSetWithIndex: 1] withRowAnimation: UITableViewRowAnimationNone]; [Self-TaleviewViewLavroATAndApath: [NSINXPath indexPathForRo: 0Injection: 0] to INDICAPPATH: [NSINXXPath indexPathForRO: 0 in size: 1]]; [Self.tableView and Updates]; which increases the exception:
One line can not be transferred to a new highlighted section (1) Am I not completely animate and can not reload the entire table?
You have to do it in two steps.
You must first add a section; You need to tell your data source in the new section's account. For a simple example like you, you can only set one variable:
- (NSInteger) numberOfSectionsInTableView: (UITableView *) table view {if (hacked section) 2 back; Return 1; } Then where you want to trigger the animation, call:
hatssection = true; // It should be set before the endupdates [self.tableView startupdates]; [Self.tableView insertSections: [NSIndexSet indexSetWithIndex: 1] withRowAnimation: UITableViewRowAnimationAutomatic]; [Self.tableView and Updates]; At this point, the table view will call the data source methods to update the table based on your changes.
Once the section has been added, you row it in the second update block:
[self.tableView startupdates]; [Self-TaleviewViewLavroATAndApath: [NSINXPath indexPathForRo: 0Injection: 0] to INDICAPPATH: [NSINXXPath indexPathForRO: 0 in size: 1]]; [Self.tableView and Updates]; Obviously, you will need to return which number of offline inaction change account to update.
Although it is a two-stage, it will look like it is happening all at once. / P>
Comments
Post a Comment