<span id="Label3"></p><p><p>The author has a function in writing the app to click on a button on the cell to modify the Cell's position in TableView</p></p><p><p>There is no problem on the ios8.</p></p><p><p>Always crashes on the ios7.</p></p><p><p>The following is a post-crash prompt:</p></p><p class="p1"><p class="p1"><strong>Terminating app due to uncaught exception ' nsinternalinconsistencyexception ', reason: ' Invalid update:invalid number of R OWS in section 0. The number of rows contained in a existing section after the update (one) must be equal to the number of rows contained in That section before the update (one), plus or minus the number of rows inserted or deleted from (1 inserted, 0 deleted) and plus or minus the number of rows moved into an or out of (0 moved in, 0 moved out).</strong></p></p><p class="p1"><p class="p1"><strong>Beginning to suspect that there is a problem with deleting or inserting indexpath. google, the solution of a variety of ways.</strong></p></p><p class="p1"><p class="p1"><strong>Later breakpoint debugging found on iOS7</strong></p></p><p class="p1"><p class="p1"><span class="s1"><strong>[</strong>self<span class="s2"><strong></strong><span class="s1"><strong>.</strong> <span class="s3"> <strong>tableview</strong><span class="s1"><strong>indexpathforcell</strong><span class="s1"><strong>: mycell] returned nil</strong></span> </span> </span> </span></span></span></p></p><p class="p1"><p class="p1"><strong>Used in the ios8.</strong></p></p><p class="p1"><p class="p1"><strong>-(</strong><span class="s1"><strong>void</strong><strong>) selecttop: (</strong><span class="s1"><strong>ID</strong><strong>) sender{</strong> </span></span></p></p><p class="p1"><p class="p1"><strong> </strong> <span class="s1"> <strong>if</strong> <strong> ([sender </strong> <span class="s2"> <strong>iskindofclass</strong><strong>: [</strong><span class="s3"><strong>UIButton </strong> <span class="s2"> <strong>class</strong><strong>]]) {</strong> </span> </span> </span></span></p></p><p class="p1"><p class="p1"><strong> </strong> <span class="s3"> <strong>UIView</strong> <strong> *view = sender;</strong></span></p></p><p class="p1"><p class="p1"><strong> </strong> <span class="s4"> <strong>applistcell</strong> <strong> *mycell = (</strong><span class="s4"><strong>applistcell</strong> <strong> *) view.</strong> <span class="s5"> <strong>superview</strong><strong>.</strong> <span class="s5"> <strong>superview</strong><strong>;</strong> </span> </span> </span></span></p></p><p class="p1"><p class="p1"><strong> </strong> <span class="s3"> <strong>nsindexpath</strong> <strong> * Cellpath = [</strong>self<span class="s1"><strong></strong><strong>.</strong> <span class="s6"> <strong>tableview</strong><span class="s2"><strong>indexpathforcell</strong><strong>: mycell];</strong> </span> </span> </span></span></p></p><p class="p1"><p class="p1"><span class="s3"><span class="s1"><span class="s6"><span class="s2"><strong>}</strong></span></span></span></span></p></p><p class="p1"><p class="p1"><strong>Google is ios7 on the cell above more than a Uitableviewwrapperview specific can be found in:</strong>http://blog.csdn.net/u013604612/article/details/23120615</p></p><p class="p1"><p class="p1">Stackoverflaw in Http://stackoverflow.com/questions/19282304/uitableview-indexpathforcell-ios6-v-ios7</p></p><p class="p1"><p class="p1">There's a good way to deal with it.</p></p><p class="p1"><p class="p1"></p></p><p class="p1"><p class="p1"><strong>-(</strong><span class="s1"><strong>void</strong><strong>) selecttop: (</strong><span class="s1"><strong>ID</strong><strong>) sender{</strong> </span></span></p></p><p class="p1"><p class="p1"><strong> </strong> <span class="s1"> <strong>if</strong> <strong> ([sender </strong> <span class="s2"> <strong>iskindofclass</strong><strong>: [</strong><span class="s3"><strong></strong> UIButton <span class="s2"> <strong> Class</strong><strong>]]) {</strong> </span> </span> </span></span></p></p><p class="p1"><p class="p1"><strong> </strong> <span class="s3"> <strong>UIView</strong> <strong> *view = sender;</strong></span></p></p><p class="p1"><p class="p1"><strong> </strong>while <span class="s1"> <strong></strong> <strong> (![ View </strong> <span class="s2"> <strong>iskindofclass</strong><strong>: [</strong><span class="s3"><strong>UITableViewCell</strong><span class="s2"><strong>class</strong><strong>] ]) {</strong></span></span></span></span></p></p><p class="p1"><p class="p1"><strong>view = [view </strong> <span class="s2"> <strong>superview</strong><strong>];</strong></span></p></p><p class="p1"><p class="p1"><strong>}</strong></p></p><p class="p1"><p class="p1"><strong> </strong> <span class="s4"> <strong>applistcell</strong> <strong> *mycell = (</strong><span class="s4"><strong>applistcell</strong> <strong> *) view;</strong> </span></span></p></p><p class="p1"><p class="p1"><strong> </strong> <span class="s3"> <strong>nsindexpath</strong> <strong> * Cellpath = [</strong>self<span class="s1"><strong></strong><strong>.</strong> <span class="s5"> <strong>tableview</strong><span class="s2"><strong>indexpathforcell</strong><strong>: mycell];</strong> </span> </span> </span></span></p></p><p class="p1"><p class="p1"><span class="s3"><span class="s1"><span class="s5"><span class="s2"><strong>}</strong></span></span></span></span></p></p><p class="p1"><p class="p1"><strong>Mark under</strong></p></p><p class="p1"><p class="p1"><strong>Really is a pit!!!</strong></p></p><p class="p1"><p class="p1"><strong>It is said that IOS6 is also two superview can be obtained!!!!</strong></p></p><p class="p1"><p class="p1"></p></p><p><p>iOS7 Indexpathforcell's pit (really a big Hole)</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service