1. Overview
Mjrefresh is one of the most commonly used open source frameworks in iOS development and is used primarily for uitanleview pull-up and pull-up refreshes. This framework is compatible with Ios6\ios7,iphone\ipad, which is now used in most business apps.
Frame Address: Https://github.com/CoderMJLee/MJRefresh
2. How to use
(1) Download frame, import header file
#import "MJREFRESH.H"
(2) How to add a header control
[Self.tableview addheaderwithtarget:self Action: @selector (headerrereshing)];
Or
[Self.tableview addheaderwithcallback:^{}];
(3) How to add a trailing control
[Self.tableview addfooterwithtarget:self Action: @selector (footerrereshing)];
Or
[Self.tableview addfooterwithcallback:^{}];
(4) You can customize the displayed text content and text color in the MJRefreshConst.h and mjrefreshconst.m files.
(5) Add drop-down refresh
Mjrefreshheaderview *header = [Mjrefreshheaderview Header];header.scrollview = Self.tableview;header.delegate = self;
(6) Add pull-up load more
Mjrefreshfooterview *footer = [Mjrefreshfooterview Footer];footer.scrollview = Self.tableview;footer.delegate = self;
(7) Monitor refresh Status
Method One, set the proxy delegate, once the control enters the refresh state, the following proxy method is called:
-(void) refreshviewbeginrefreshing: (Mjrefreshbaseview *) refreshview{if ([Refreshview iskindofclass:[ Mjrefreshfooterview class]]) {//pull-up loads more} else {//dropdown refresh}}
Method Two, set the block callback:
Header.beginrefreshingblock = ^ (Mjrefreshbaseview *refreshview) {};
Footer.beginrefreshingblock = ^ (Mjrefreshbaseview *refreshview) {};
(8) Enter the refresh status
[Self.tableview headerbeginrefreshing]; [Self.tableview footerbeginrefreshing];
(9) End Refresh
[Self.tableview headerendrefreshing]; [Self.tableview footerendrefreshing];
(10) If necessary, the audio function can be turned on by controlling the Needaudio macro in MJRefreshBaseView.h.
iOS Development Mjrefresh