UITableView load to the bottom of the viewwillappear

Source: Internet
Author: User
<span id="Label3"></p><p><p>Needs</p></p><p><p><span style="white-space:pre"> </span>1. Implementing the Timeline Effect</p></p><p><p><span style="white-space:pre"> </span>2. The data shows the top of the old data, the bottom is the latest data (speaking a little anti-normal iOS logic, but this is the demand, resigned to it ~)</p></p><p><p><span style="white-space:pre"> </span>3. When you enter the page, scroll directly to the lowest part</p></p><p><p><span style="white-space:pre"> </span>4. Some cells need to be self-adapting</p></p><p><p><span style="white-space:pre"> </span>5. Refresh mechanism: at the bottom of the latest data, swipe up to the bottom to load the new Data. Swipe down to load old data dynamically.</p></p><p><p>Issus:</p></p><p><p><span style="white-space:pre"></span> After the network requests the data, Reloaddata. Scroll to the bottom</p></p><p><p>Try the Solution:</p></p><p><p>1. Scroll to the bottom:</p></p><p><p><span style="white-space:pre"></span> workaround:</p></p><p><p><span style="white-space:pre"></span> the first type:</p></p><p><p>Nsindexpath *indexpath = [nsindexpath indexpathforrow: ([self.tableview numberofrowsinsection:0]-1) inSection:0];</p></p><p><p>[self.tableview Scrolltorowatindexpath:indexpath Atscrollposition:uitableviewscrollpositionbottom animated:YES];</p></p><p><p>The second type:</p></p><p><p>CGFloat height = self.tableview.contentsize.height-self.tableview.height;</p></p><p><p>[self.tableview setcontentoffset:cgpointmake (0, height)];</p></p><p><p>Remaining issues:</p></p><p><p><span style="white-space:pre"></span> I suspect that it should be the result of a view adaptation, and that the view is not displayed and is not scrolled to the BOTTOM.</p></p><p><p><br></p></p><p><p>UITableView load to the bottom of the viewwillappear</p></p></span>

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.