[IOS] Have you ever used a native Uirefreshcontrol?

Source: Internet
Author: User

Third party too powerful, pull up refresh, drop down brush down, left, right, various refreshes,

Introduce several third parties first:

Jhrefresh:https://github.com/jiahai/jhrefresh

You can customize the animation of the top, drop-down refresh, the demo effect is similar to the animation effect of popular reviews, animation is the implementation of frame animation

Then bring your own picture Group ~ ~ ~



Mjrefresh:https://github.com/codermjlee/mjrefresh

Simple to use, support TableView, CollectionView: See GitHub connection for details


Aapulltorefresh:https://github.com/r-plus/aapulltorefresh

The front of the pull, pull down, this can be Zola, right pull, good magical things



Tmotableview:https://github.com/duowan/tmotableview

When the small partners pull the refresh, this feature is supported click Auto Load, is not very

Humanized...... XXX ~ ~



Of course, there is a long history ... Something that looks like an elder.

Egotableviewpullrefresh:https://github.com/enormego/egotableviewpullrefresh


After talking about the powerful third party, the native Uirefreshcontrol became extinct with interpersonal ...

Mo mo alone cries .... But sometimes we don't want to be so powerful as long as the simple pull-down refresh it ...

Just a little Uirefreshcontrol story ...

First, it can only be used under TableView, and you'll find it in Uitableviewcontroller.


Specific code of Use:

    Self.refresh = [[Uirefreshcontrol alloc]init];    NSLog (@ "%.2f%.2f", self.refresh.frame.size.width,self.refresh.frame.size.height);    Self.refresh.tintColor = [Uicolor bluecolor];    Self.refresh.attributedTitle = [[nsattributedstring alloc]initwithstring:@ "dropdown refresh"];;    [Self.refresh addtarget:self Action: @selector (refreshviewcontroleventvaluechanged) forControlEvents: Uicontroleventvaluechanged];    [Self.tableview AddSubview:self.refresh];
<pre name= "code" class= "OBJC" >-(void) refreshviewcontroleventvaluechanged{    NSLog (@ "Refresh XXXX");    Dispatch_after (Dispatch_time (Dispatch_time_now, (int64_t) (3.0 * nsec_per_sec)), Dispatch_get_main_queue (), ^{//        [Loadingimageview Removefromsuperview];        [Self.refresh endrefreshing];    });


Jumping to the head file will find that the inside of something less pathetic, uirefreshcontrol frame start is also the default, generally also by it depends on the controller or view

To control, typically Uitableviewcontroller or tableview, a uicontroleventvaluechanged notification is broadcast at the moment of pull.

That's all we can get.

Can we customize the picture to achieve the next draw like the fruit Library

Find a way to add a picture, and then find the following code, but the system's animation will be in the middle of the picture

    Loadingimageview = [[Uiimageview alloc] initwithimage:[uiimage imagenamed: @ "Loading"];    Loadingimageview.center = Cgpointmake (187.5, +);    [Self.refresh Insertsubview:loadingimageview atindex:0];    [Self.refresh Bringsubviewtofront:loadingimageview];


Then judge can only inherit rewrite Uirefreshcontrol, and then become more complex ...

It's almost time to eat. Find it and then make up ... y_y ~


[IOS] Have you ever used a native Uirefreshcontrol?

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.