iOS Development Mjrefresh

Source: Internet
Author: User

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

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.