UITableView Scroll to the last line

Source: Internet
Author: User

This article reprinted to http://mrjeye.iteye.com/blog/1278521

-(void) Scrolltabletofoot: (BOOL) animated

{

Nsinteger s = [Self.tableview numberofsections];

if (s<1) return;

Nsinteger r = [Self.tableview numberofrowsinsection:s-1];

if (r<1) return;

Nsindexpath *ip = [Nsindexpath indexpathforrow:r-1 insection:s-1];

[Self.tableview Scrolltorowatindexpath:ip Atscrollposition:uitableviewscrollpositionbottom animated:animated];

}

############

    1. Can be implemented in viewdidappear to join [Tablvew setcontentoffset:cgpointmake (0,480) Animated:yes];
    2. Add a searchbar to the TableView, scroll together, and initially hide the Headerview (the height that lets tableview scroll up headerview: Default 44)
    3. Uisearchbar *mysearchbar = [[Uisearchbar alloc] init];
    4. [Mysearchbar SizeToFit];
    5. Tableview.tableheaderview = Mysearchbar;
    6. UITableView start scrolling to the position (so that the first Headerview is not displayed)
    7. [TableView setcontentoffset:cgpointmake (0.0, 44.0) Animated:no];

UITableView Scroll to the last line

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.