iOS detailed tableview: Built-in refresh, EGO, and search display controller

Source: Internet
Author: User

These days because of the network of the place to live a little problem, in addition to the Q, on the micro-blog other than the Web page can not be landed. Blogs are not followed up.

Resumed today, so continue to update the blog. I also hope that you can continue to comment or give me some advice or exchange:-)

Today found a previous example of a tableview, mainly about up and down pull refresh, so wrote a demo, and then updated to the blog.

Built-in Refresh

Built-in refresh is Apple IOS6 after the introduction of an API, mainly for Tableviewcontroller added a property, Refreshcontrol, so if you want to use this built-in Drop-down refresh, it is best to Your TableView specifies a dedicated view controller.

When used, we need to assign a Uirefreshcontrol object to Refreshcontrol. Follow the header file to see

Three properties, the initialization of three methods, not difficult, and then configure Refreshcontrol

/****** built-in refresh of common generic

settings ******/
uirefreshcontrol *refresh = [[Uirefreshcontrol alloc] init];  
Refresh.attributedtitle = [[Nsattributedstring alloc] initwithstring:@ "Drop-down refresh"];  
Refresh.tintcolor = [Uicolor bluecolor];  
[Refresh Addtarget:self action: @selector (Pulltorefresh) 

forcontrolevents:uicontroleventvaluechanged];  
Self.refreshcontrol = Refresh;

Set up a listening method to simply look at its implementation

Drop-down

Refresh  
-(void) Pulltorefresh  
{  
    //analog network access  
    [UIApplication sharedapplication]. networkactivityindicatorvisible = YES;  
    Self.refreshControl.attributedTitle = [[Nsattributedstring alloc] initwithstring:@ "Refresh

"];  
          
    Double delayinseconds = 1.5;  
    dispatch_time_t poptime = Dispatch_time (Dispatch_time_now, (int64_t) (Delayinseconds * 

nsec_per_sec));  
    Dispatch_after (Poptime, Dispatch_get_main_queue (), ^ (void) {  
        _rowcount = 5;  
        [Self.tableview Reloaddata];  
        Refresh control settings At the end of the refresh  
        [Self.refreshcontrol endrefreshing];  
        Self.refreshControl.attributedTitle = [[Nsattributedstring alloc] initwithstring:@ "Drop-down

Refresh"];  
              
        [UIApplication sharedapplication].networkactivityindicatorvisible = NO;  
        _bottomrefresh.frame = CGRectMake (0, 44+_rowcount*rcellheight, rcellheight);}  

Related Article

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.