An easy way to use pull-to-refresh.

Overview

MJRefresh

SPM supported Carthage compatible podversion

  • An easy way to use pull-to-refresh

📜 ✍🏻Release Notes: more details

Contents

New Features

Dynamic i18n Switching

Now MJRefresh components will be rerendered automatically with MJRefreshConfig.default.language setting.

Example

Go i18n folder and see lots of cases. Simulator example is behind i18n tab in right-top corner.

Setting language

MJRefreshConfig.default.language = "zh-hans"

Setting i18n file name

MJRefreshConfig.default.i18nFilename = "i18n File Name(not include type<.strings>)"

Setting i18n language bundle

MJRefreshConfig.default.i18nBundle = <i18n Bundle>

Adopting the feature in your DIY component

  1. Just override i18nDidChange function and reset texts.
// must use this localization methods
Bundle.mj_localizedString(forKey: "")
// or
Bundle.mj_localizedString(forKey: "", value:"")

override func i18nDidChange() {
    // Reset texts function
    setupTexts()
    // Make sure to call super after resetting texts. It will call placeSubViews for applying new layout.
    super.i18nDidChange()
}
  1. Receiving MJRefreshDidChangeLanguageNotification notification.

SPM Supported

Released from 3.7.1

Swift Chaining Grammar Supported

  // Example as MJRefreshNormalHeader
  func addRefreshHeader() {
      MJRefreshNormalHeader { [weak self] in
  	  // load some data
      }.autoChangeTransparency(true)
      .link(to: tableView)
  }

Support what kinds of controls to refresh

  • UIScrollViewUITableViewUICollectionViewWKWebView

How to use MJRefresh

  • Installation with CocoaPods:pod 'MJRefresh'
  • Installation with Carthagegithub "CoderMJLee/MJRefresh"
  • Manual import:
    • Drag All files in the MJRefresh folder to project
    • Import the main file:#import "MJRefresh.h"
Base                        Custom
MJRefresh.bundle            MJRefresh.h
MJRefreshConst.h            MJRefreshConst.m
UIScrollView+MJExtension.h  UIScrollView+MJExtension.m
UIScrollView+MJRefresh.h    UIScrollView+MJRefresh.m
UIView+MJExtension.h        UIView+MJExtension.m

More than hundreds of Apps are using MJRefresh

* More information of App can focus on:[M了个J-博客园](http://www.cnblogs.com/mjios/p/4409853.html)

The Class Structure Chart of MJRefresh

  • The class of red text in the chart:You can use them directly

    • The drop-down refresh control types
      • Normal:MJRefreshNormalHeader
      • Gif:MJRefreshGifHeader
    • The pull to refresh control types
      • Auto refresh
        • Normal:MJRefreshAutoNormalFooter
        • Gif:MJRefreshAutoGifFooter
      • Auto Back
        • Normal:MJRefreshBackNormalFooter
        • Gif:MJRefreshBackGifFooter
  • The class of non-red text in the chart:For inheritance,to use DIY the control of refresh

  • About how to DIY the control of refresh,You can refer the Class in below Chart

MJRefreshComponent.h

/** The Base Class of refresh control */
@interface MJRefreshComponent : UIView
#pragma mark -  Control the state of Refresh 

/** BeginRefreshing */
- (void)beginRefreshing;
/** EndRefreshing */
- (void)endRefreshing; 
/** IsRefreshing */
- (BOOL)isRefreshing;

#pragma mark - Other
/** According to the drag ratio to change alpha automatically */
@property (assign, nonatomic, getter=isAutomaticallyChangeAlpha) BOOL automaticallyChangeAlpha;
@end

MJRefreshHeader.h

@interface MJRefreshHeader : MJRefreshComponent
/** Creat header */
+ (instancetype)headerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;
/** Creat header */
+ (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;

/** This key is used to storage the time that the last time of drown-down successfully */
@property (copy, nonatomic) NSString *lastUpdatedTimeKey;
/** The last time of drown-down successfully */
@property (strong, nonatomic, readonly) NSDate *lastUpdatedTime;

/** Ignored scrollView contentInset top */
@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetTop;
@end

MJRefreshFooter.h

@interface MJRefreshFooter : MJRefreshComponent
/** Creat footer */
+ (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;
/** Creat footer */
+ (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;

/** NoticeNoMoreData */
- (void)noticeNoMoreData;
/** ResetNoMoreData(Clear the status of NoMoreData ) */
- (void)resetNoMoreData;

/** Ignored scrollView contentInset bottom */
@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetBottom;
@end

MJRefreshAutoFooter.h

@interface MJRefreshAutoFooter : MJRefreshFooter
/** Is Automatically Refresh(Default is Yes) */
@property (assign, nonatomic, getter=isAutomaticallyRefresh) BOOL automaticallyRefresh;

/** When there is much at the bottom of the control is automatically refresh(Default is 1.0,Is at the bottom of the control appears in full, will refresh automatically) */
@property (assign, nonatomic) CGFloat triggerAutomaticallyRefreshPercent;
@end

MJRefreshTrailer.h

@interface MJRefreshTrailer : MJRefreshComponent

/** 创建trailer */
+ (instancetype)trailerWithRefreshingBlock:(MJRefreshComponentAction)refreshingBlock;
/** 创建trailer */
+ (instancetype)trailerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;

/** 忽略多少scrollView的contentInset的right */
@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetRight;

@end

Reference

* Due to there are more functions of this framework,Don't write specific text describe its usage
* You can directly reference examples MJTableViewController、MJCollectionViewController、MJWebViewController,More intuitive and fast.

The drop-down refresh 01-Default

self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
   //Call this Block When enter the refresh status automatically 
}];
或
// Set the callback(Once you enter the refresh status,then call the action of target,that is call [self loadNewData])
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];

// Enter the refresh status immediately
[self.tableView.mj_header beginRefreshing];

(下拉刷新01-普通)

The drop-down refresh 02-Animation image

// Set the callback(一Once you enter the refresh status,then call the action of target,that is call [self loadNewData])
MJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
// Set the ordinary state of animated images
[header setImages:idleImages forState:MJRefreshStateIdle];
// Set the pulling state of animated images(Enter the status of refreshing as soon as loosen)
[header setImages:pullingImages forState:MJRefreshStatePulling];
// Set the refreshing state of animated images
[header setImages:refreshingImages forState:MJRefreshStateRefreshing];
// Set header
self.tableView.mj_header = header;

(下拉刷新02-动画图片)

The drop-down refresh 03-Hide the time

// Hide the time
header.lastUpdatedTimeLabel.hidden = YES;

(下拉刷新03-隐藏时间)

The drop-down refresh 04-Hide status and time

// Hide the time
header.lastUpdatedTimeLabel.hidden = YES;

// Hide the status
header.stateLabel.hidden = YES;

(下拉刷新04-隐藏状态和时间0)

The drop-down refresh 05-DIY title

// Set title
[header setTitle:@"Pull down to refresh" forState:MJRefreshStateIdle];
[header setTitle:@"Release to refresh" forState:MJRefreshStatePulling];
[header setTitle:@"Loading ..." forState:MJRefreshStateRefreshing];

// Set font
header.stateLabel.font = [UIFont systemFontOfSize:15];
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:14];

// Set textColor
header.stateLabel.textColor = [UIColor redColor];
header.lastUpdatedTimeLabel.textColor = [UIColor blueColor];

(下拉刷新05-自定义文字)

The drop-down refresh 06-DIY the control of refresh

self.tableView.mj_header = [MJDIYHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
// Implementation reference to MJDIYHeader.h和MJDIYHeader.m

(下拉刷新06-自定义刷新控件)

The pull to refresh 01-Default

self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
    //Call this Block When enter the refresh status automatically
}];
或
// Set the callback(Once you enter the refresh status,then call the action of target,that is call [self loadMoreData])
self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];

(上拉刷新01-默认)

The pull to refresh 02-Animation image

// Set the callback(Once you enter the refresh status,then call the action of target,that is call [self loadMoreData])
MJRefreshAutoGifFooter *footer = [MJRefreshAutoGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];

// Set the refresh image
[footer setImages:refreshingImages forState:MJRefreshStateRefreshing];

// Set footer
self.tableView.mj_footer = footer;

(上拉刷新02-动画图片)

The pull to refresh 03-Hide the title of refresh status

// Hide the title of refresh status
footer.refreshingTitleHidden = YES;
// If does have not above method,then use footer.stateLabel.hidden = YES;

(上拉刷新03-隐藏刷新状态的文字)

The pull to refresh 04-All loaded

//Become the status of NoMoreData
[footer noticeNoMoreData];

(上拉刷新04-全部加载完毕)

The pull to refresh 05-DIY title

// Set title
[footer setTitle:@"Click or drag up to refresh" forState:MJRefreshStateIdle];
[footer setTitle:@"Loading more ..." forState:MJRefreshStateRefreshing];
[footer setTitle:@"No more data" forState:MJRefreshStateNoMoreData];

// Set font
footer.stateLabel.font = [UIFont systemFontOfSize:17];

// Set textColor
footer.stateLabel.textColor = [UIColor blueColor];

(上拉刷新05-自定义文字)

The pull to refresh 06-Hidden After loaded

//Hidden current control of the pull to refresh
self.tableView.mj_footer.hidden = YES;

(上拉刷新06-加载后隐藏)

The pull to refresh 07-Automatic back of the pull01

self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];

(上拉刷新07-自动回弹的上拉01)

The pull to refresh 08-Automatic back of the pull02

MJRefreshBackGifFooter *footer = [MJRefreshBackGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];

// Set the normal state of the animated image
[footer setImages:idleImages forState:MJRefreshStateIdle];
//  Set the pulling state of animated images(Enter the status of refreshing as soon as loosen)
[footer setImages:pullingImages forState:MJRefreshStatePulling];
// Set the refreshing state of animated images
[footer setImages:refreshingImages forState:MJRefreshStateRefreshing];

// Set footer
self.tableView.mj_footer = footer;

(上拉刷新07-自动回弹的上拉02)

The pull to refresh 09-DIY the control of refresh(Automatic refresh)

self.tableView.mj_footer = [MJDIYAutoFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
// Implementation reference to MJDIYAutoFooter.h和MJDIYAutoFooter.m

(上拉刷新09-自定义刷新控件(自动刷新))

The pull to refresh 10-DIY the control of refresh(Automatic back)

self.tableView.mj_footer = [MJDIYBackFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
// Implementation reference to MJDIYBackFooter.h和MJDIYBackFooter.m

(上拉刷新10-自定义刷新控件(自动回弹))

UICollectionView01-The pull and drop-down refresh

// The drop-down refresh
self.collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
   //Call this Block When enter the refresh status automatically 
}];

// The pull to refresh
self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
   //Call this Block When enter the refresh status automatically
}];

(UICollectionView01-上下拉刷新)

UICollectionView02-The trailer refresh

// The trailer refresh
self.collectionView.mj_trailer = [MJRefreshNormalTrailer trailerWithRefreshingBlock:^{
   //Call this Block When enter the refresh status automatically 
}];

(UICollectionView02-左拉刷新)

WKWebView01-The drop-down refresh

//Add the control of The drop-down refresh
self.webView.scrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
   //Call this Block When enter the refresh status automatically
}];

(UICollectionView01-上下拉刷新)

Remind

  • ARC
  • iOS>=9.0
  • iPhone \ iPad screen anyway

寻求志同道合的小伙伴

  • 因本人工作忙,没有太多时间去维护MJRefresh,在此向广大框架使用者说声:非常抱歉! 😞
  • 现寻求志同道合的小伙伴一起维护此框架,有兴趣的小伙伴可以发邮件给我,非常感谢 😊
  • 如果一切OK,我将开放框架维护权限(github、pod等)
  • 目前已经找到3位小伙伴(^-^)V
Comments
  • 关于iOS11及以上版本上拉加载更多会出现跳跃式bug

    关于iOS11及以上版本上拉加载更多会出现跳跃式bug

    理论上来讲加上以下四行代码就可以了。但是我的项目在主页就不可以,加了四行代码还是一样的跳跃,而且跳跃的距离大概是一屏多一点的高度,其他push出来的界面又没事。iOS11这次更新真是晔了狗了,大家有遇到过吗?有没有好的解决方案呢? if (@available(iOS 11.0, *)) { self.mainTableView.estimatedRowHeight = 0; self.mainTableView.estimatedSectionFooterHeight = 0; self.mainTableView.estimatedSectionHeaderHeight = 0; self.mainTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; }

    duplicate-重复的问题 
    opened by unseim 25
  • 刚升级xcode到8.0,运行工程MJRefresh就崩溃了

    刚升级xcode到8.0,运行工程MJRefresh就崩溃了

    reason: *** -[NSTaggedPointerString substringToIndex:]: Index 9223372036854775807 out of bounds; string length 2 callStackSymbols: ( 0 CoreFoundation 0x00000001113a034b exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010b00a21e objc_exception_throw + 48 2 CoreFoundation 0x0000000111409265 +[NSException raise:format:] + 197 3 Foundation 0x000000010d7d70a4 -[NSString substringToIndex:] + 118 4 Meixue 0x0000000109149781 -[MJRefreshComponent localizedStringForKey:withDefault:] + 492 5 Meixue 0x000000010914d250 -[MJRefreshStateHeader setLastUpdatedTimeKey:] + 704 6 Meixue 0x000000010914b22b -[MJRefreshHeader prepare] + 75 7 Meixue 0x000000010914d4ec -[MJRefreshStateHeader prepare] + 51 8 Meixue 0x000000010914c1d3 -[MJRefreshNormalHeader prepare] + 43 9 Meixue 0x0000000109148f4b -[MJRefreshComponent initWithFrame:] + 105 10 UIKit 0x000000010f929788 -[UIView init] + 62 11 Meixue 0x000000010914b1ab +[MJRefreshHeader headerWithRefreshingTarget:refreshingAction:] + 68 12 Meixue 0x0000000108e3f065 -[ARMainVC setupRefreash] + 106 13 Meixue 0x0000000108e35b14 -[ARMainVC viewDidLoad] + 1036 14 UIKit 0x000000010fa3806d -[UIViewController loadViewIfRequired] + 1258 15 UIKit 0x000000010fa384a0 -[UIViewController view] + 27 16 Meixue 0x0000000108fd2768 -[ARMainContainerVC setContainerControllerWithTagTitle:] + 622 17 Meixue 0x0000000108fcde5c -[ARMainContainerVC containerSV] + 994 18 Meixue 0x0000000108fcb70d -[ARMainContainerVC viewDidLoad] + 1170 19 UIKit 0x000000010fa3806d -[UIViewController loadViewIfRequired] + 1258 20 UIKit 0x000000010fa7844f -[UINavigationController _layoutViewController:] + 55 21 UIKit 0x000000010fa78d37 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 471 22 UIKit 0x000000010fa78eae -[UINavigationController _startTransition:fromViewController:toViewController:] + 133 23 UIKit 0x000000010fa7a0b9 -[UINavigationController _startDeferredTransitionIfNeeded:] + 874 24 UIKit 0x000000010fa7b19b -[UINavigationController __viewWillLayoutSubviews] + 58 25 UIKit 0x000000010fc721b7 -[UILayoutContainerView layoutSubviews] + 223 26 UIKit 0x000000010f95b344 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237 27 QuartzCore 0x000000010f589cdc -[CALayer layoutSublayers] + 146 28 QuartzCore 0x000000010f57d7a0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 29 QuartzCore 0x000000010f57d61e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 30 QuartzCore 0x000000010f50b62c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280 31 QuartzCore 0x000000010f538713 _ZN2CA11Transaction6commitEv + 475 32 QuartzCore 0x000000010f539083 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113 33 CoreFoundation 0x0000000111344e17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 34 CoreFoundation 0x0000000111344d87 __CFRunLoopDoObservers + 391 35 CoreFoundation 0x00000001113294b6 CFRunLoopRunSpecific + 454 36 UIKit 0x000000010f890db6 -[UIApplication _run] + 434 37 UIKit 0x000000010f896f34 UIApplicationMain + 159 38 Meixue 0x0000000108d21c2d main + 109 39 libdyld.dylib 0x00000001120e568d start + 1 )

    希望能得到答案谢谢

    opened by magicalccong 25
  • 最新版3.3.1还是会出现下拉不回弹

    最新版3.3.1还是会出现下拉不回弹

    描述bug 之前使用旧版本会导致下拉之后不回弹,然后昨天替换成最新版本还是会出现同样的问题.我观察到的现象是出现不回弹的情况后,还是可以下拉界面,这应该就是意味着重置Bounds的动画已经结束.所以我猜测是不是过程中设置Bounds的时候,哪个环节的值没有获取对导致Bounds无法还原.

    必现/偶发? 偶发

    你期望的结果是什么? 希望能解决掉下拉之后不会弹的问题

    运行环境 刘海屏

    额外的 最好能提供出现bug的Demo

    bug 
    opened by seanLee 21
  • ios11使用estimatedRowHeight和UITableViewAutomaticDimension如果cell高度不一致,上拉加载bug

    ios11使用estimatedRowHeight和UITableViewAutomaticDimension如果cell高度不一致,上拉加载bug

    ios11使用estimatedRowHeight和UITableViewAutomaticDimension,如果cell高度不一致,上拉加载以后,原先的最后一行的cell会自动往上跳动,同时上拉加载会执行好多次。 在ios10上未出现该问题。 因为用到cell的高度自动布局,所以不能设置estimatedRowHeight为0

    MJRefresh的版本为3.1.14.1

    duplicate-重复的问题 
    opened by HanXiaoTeng 21
  • 上拉刷新问题

    上拉刷新问题

    我在viewDidLoad中使用collectionView?.header.beginRefreshing()这个进入页面就开始刷新加载数据 但上拉加载就不能用了

    self.collectionView?.footer = MJRefreshAutoNormalFooter(refreshingTarget: self, refreshingAction: "footerRefresh") 这个方法就不执行了

    如果在viewDidLoad,调用加载数据的方法,不用collectionView?.header.beginRefreshing(),上拉加载就可以用了,这是什么原因?

    opened by wasonxie 21
  • 特定条件下, 下拉刷新导致cell不响应selectRow方法

    特定条件下, 下拉刷新导致cell不响应selectRow方法

    一个viewController, 加上tableView, 设置mj_header, 刷新事件就是停止和reload 可能类似于 #843 #1218 特定条件: 不是所有机型都出问题, 目前遇到: 模拟器iPhoneXS MAX iOS12.1 真机6P 12.0

    调试了下发现cell触发了touchesBegan, 但是很快就touchesCancelled没有正常end导致点击无效

    1. vc在navigationController里( PUSH或者rootViewController)
    2. tableView只有两个数据
    3. cell高度为69.333 (也有一些其它高度比如71.333等等
    4. 下拉触发refresh
    5. 点击 cell, 不触发 didSelectRow

    下面是vc代码, 下拉刷新后点击无效(代码被格了样式, 能看懂就好 使用系统UIRefreshControl替代MJRefresh没问题

    #import "ViewController.h"
    #import <MJRefresh/MJRefresh.h>
    
    @interface ViewController ()<UITableViewDelegate, UITableViewDataSource>
    @property (nonatomic, strong) UITableView *tableView;
    @end
    
    @implementation ViewController
    - (void)viewDidLoad {
        [super viewDidLoad];
        _tableView = [[UITableView alloc] init];
        [self.view addSubview:_tableView];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.translatesAutoresizingMaskIntoConstraints = NO;
        _tableView.tableFooterView = [UIView new];
        [NSLayoutConstraint activateConstraints:@[
                                                  [_tableView.topAnchor constraintEqualToAnchor:self.view.topAnchor],
                                                  [_tableView.leftAnchor constraintEqualToAnchor:self.view.leftAnchor],
                                                  [_tableView.rightAnchor constraintEqualToAnchor:self.view.rightAnchor],
                                                  [_tableView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor],
                                                  ]];
        _tableView.mj_header = [MJRefreshHeader headerWithRefreshingTarget:self refreshingAction:@selector(refresh)];
        [self refresh];
    }
    
    - (void)refresh
    {
        [self.tableView.mj_header endRefreshing];
        [self.tableView reloadData];
    }
    
    #pragma mark TableViewDelegate
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
        return 2;
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        return [UITableViewCell new];
    }
    
    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
        return 69.3333; // 69.3333  71.33333 etc.
    }
    
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        
    }
    @end
    
    opened by tristanSIF 18
  • 下拉刷新状态中,切换tabbar到另外一个rootvc,再点击tabbar返回,下拉状态消失了

    下拉刷新状态中,切换tabbar到另外一个rootvc,再点击tabbar返回,下拉状态消失了

    描述bug 下拉刷新状态中,切换tabbar到另外一个rootvc,再点击tabbar返回,下拉状态消失了

    必现/偶发? 必现

    怎么样重现这个bug 下拉刷新状态中,切换tabbar到另外一个rootvc,再点击tabbar返回,下拉状态消失

    你期望的结果是什么? 继续展示下拉刷新的状态

    截图 如果有必要的话,请上传几张截图

    运行环境

    • iPhone7Plus
    • iOS12.1
    • Xcode10.2
    discussion-讨论 
    opened by Maxcucurbit 15
  • 下拉刷新位置计算错误(与预估高度无关)

    下拉刷新位置计算错误(与预估高度无关)

    下拉刷新到可以刷新的高度不松手 点击tabbar其他item切换页面 此收到刷新的回调 请求完成后调用[weakSelf.tableView.mj_header endRefreshing]; 再返回切换前的页面

    看源代码 应该是由于当前页面不是正在显示的时候 [self setNeedsLayout]; 不会触发- (void)layoutSubviews; 导致- (void)placeSubviews 不重新计算下拉刷新位置

    opened by sxdxzkq 15
  • [BUG] iOS10 奔溃 在英语环境

    [BUG] iOS10 奔溃 在英语环境

    Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSTaggedPointerString substringToIndex:]: Index 9223372036854775807 out of bounds; string length 2' *** First throw call stack: ( 0 CoreFoundation 0x000000010413f34b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x0000000107dbc21e objc_exception_throw + 48 2 CoreFoundation 0x00000001041a8265 +[NSException raise:format:] + 197 3 Foundation 0x0000000104c630a4 -[NSString substringToIndex:] + 118 4 LovePlayNews 0x00000001038b8565 -[MJRefreshComponent localizedStringForKey:withDefault:] + 357 5 LovePlayNews 0x00000001038b83cf -[MJRefreshComponent localizedStringForKey:] + 79 6 LovePlayNews 0x00000001038be491 -[MJRefreshStateHeader setLastUpdatedTimeKey:] + 1569 7 LovePlayNews 0x00000001038baf66 -[MJRefreshHeader prepare] + 86 8 LovePlayNews 0x00000001038be5e6 -[MJRefreshStateHeader prepare] + 54 9 LovePlayNews 0x00000001038b796f -[MJRefreshComponent initWithFrame:] + 159 10 UIKit 0x0000000105edb788 -[UIView init] + 62 11 LovePlayNews 0x00000001038baeaf +[MJRefreshHeader headerWithRefreshingTarget:refreshingAction:] + 95 12 LovePlayNews 0x0000000103694bea +[LPRefreshGifHeader headerWithRefreshingTarget:refreshingAction:] + 122 13 LovePlayNews 0x000000010369fdfc -[LPNewsListController addRefreshHeader] + 60 14 LovePlayNews 0x000000010369fa7c -[LPNewsListController viewDidLoad] + 92

    opened by 12207480 13
  • iOS  15下使用MJRefreshAutoFooter/MJRefreshBackFooter,结束刷新时可能会有一些不符合预期的动画效果

    iOS 15下使用MJRefreshAutoFooter/MJRefreshBackFooter,结束刷新时可能会有一些不符合预期的动画效果

    描述bug iOS 15下使用MJRefreshAutoFooter/MJRefreshBackFooter,结束刷新时可能会有一些不符合预期的动画效果。 实测在iOS 15以下不会出现此问题。

    必现/偶发? 必现

    怎么样重现这个bug 1、UITableView/UICollectionView使用performBatchUpdates:completion:,在completion回调里调用 [weakSelf.collectionView.mj_footer endRefreshing]

    你期望的结果是什么? 不会出现额外的动画效果

    视频 观察视频中页面底部的mj_footer,会有明显的下滑动画。 https://user-images.githubusercontent.com/22904757/141225139-e73e1cd4-67b9-48cf-b702-4f09c78cdaab.mov

    DEMO 全局搜索:issues/1552,来查看改动的地方,Demo中也已经提供了解决方案 MJRefreshIssue.zip

    运行环境

    • iPhone 13 Pro 模拟器
    • iOS 15.0
    • Xcode 13.1
    bug 
    opened by jiasongs 12
  • iOS13下UICollectionView使用MJRefreshFooter时,下拉刷新时底部的cell会出现奇怪的动画

    iOS13下UICollectionView使用MJRefreshFooter时,下拉刷新时底部的cell会出现奇怪的动画

    描述bug iOS13下UICollectionView使用MJRefreshFooter时,下拉到一定距离(最后一排cell离开屏幕),然后松开,底部的cell会出现奇怪的动画。iOS12及以下没有这个问题,我看市场上好多使用MJRefresh框架的应用都有这个问题。

    必现/偶发? 必现

    怎么样重现这个bug iOS13下,当UICollectionView使用上拉和下拉控件时,下拉回弹时,底部的cell会凭空出现

    截图 2019-11-01 15-18-52 2019-11-01 15_19_31

    运行环境

    • iPhone Xs
    • iOS13.0
    • Xcode10
    bug 
    opened by gongsunqingyang 12
  • Fix Bug:带灵动导的机型在某些场景中下拉刷新死循环

    Fix Bug:带灵动导的机型在某些场景中下拉刷新死循环

    关联 #1575 Fix Bug:带灵动导的机型的adjustedContentInset.top(包含safeAreaInsets.top)返回一个浮点数精度极高的异常值 影响判断 下拉刷新造成死循环

    复现case: 1、ViewController 在viewWillAppear里 edgesForExtendedLayout.insert(.top) 2、scrollView的edges equal to superView布局 3、scrollView设置了contentInsets.top 比如32 4、执行下拉刷新 @CoderMJLee @wolfcon 截屏2022-09-27 19 34 46

    opened by iAmNotTom 0
  • iphone14 pro灵动岛,MJRefresh闪退

    iphone14 pro灵动岛,MJRefresh闪退

    描述bug

    我使用了JXSegmentedView框架 override func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {

        switch index {
        case 0:
            return NQPersonalQuestionListVC(actType: NQMyActType.Favorite.rawValue)
        case 1:
            return NQPersonalAnswerListVC(actType: NQMyActType.Favorite.rawValue)
        case 2:
            return NQPersonalEventListVC(vcType: .Forum, actType: NQMyActType.Favorite.rawValue)
        case 3:
            return NQPersonalEventListVC(vcType: .Webinar, actType: NQMyActType.Favorite.rawValue)
        default:
            return NQPersonalQuestionListVC(actType: NQMyActType.Favorite.rawValue)
        }
    }
    

    在NQPersonalQuestionListVC控制器里面,设置 tableView.contentInset = UIEdgeInsets(top: Configs.BaseDimensions.headerInSectionHeight, left: 0, bottom: 0, right: 0) 在iphone14 pro灵动岛,MJRefresh下拉刷新闪退,必现

    但是如果设置 tableView.contentInsetAdjustmentBehavior = .never tableView.contentInset = UIEdgeInsets(top: Configs.BaseDimensions.navigationBarAreaHeight + Configs.BaseDimensions.headerInSectionHeight, left: 0, bottom: safeAreaBottom, right: 0) 不会出现闪退

    运行环境

    • iphone14 pro
    • iOS16
    • Xcode14 1664175979795 1664176027746
    bug 
    opened by shandawy 4
  • iOS 15 uicollectionView autofooter 上拉后,会卡顿一下

    iOS 15 uicollectionView autofooter 上拉后,会卡顿一下

    描述bug collectionView上拉 加载自定义gif footer 刚出现界面时会卡顿一下,

    必现/偶发? 必现

    怎么样重现这个bug collectionView上拉拖动 footer 刚出现界面就可以复现

    你期望的结果是什么? 通过对比发现旧版本3.1.12与最新(3.7.5)在某些写法上有差异 在这个commit上, 628266f540dfedfd3bb3c0a33ad92c7a3618b8ed

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [self executeRefreshingCallback];
     });
    

    发现这行代码移除了延迟调用,但是我发现重新加上这行代码之后,footer刚出现在屏幕上就不会对collectionView造成卡顿了,想请教大佬是出于什么原因呢,speed up?,谢谢大佬

    运行环境

    • iPhone xs
    • iOS15.5
    • Xcode13.4.1
    bug 
    opened by tang786472181 1
  • 3.7.2 還是有這個問題

    3.7.2 還是有這個問題

    整个控制器就是collectionController 用[[UICollectionViewFlowLayout alloc]init]创建的 然后设置collection的背景图 下拉刷新的时候整个背景图会上下弹一下

    Originally posted by @674481501 in https://github.com/CoderMJLee/MJRefresh/issues/1305#issuecomment-506255800

    opened by ericlee16888 1
  • UICollectionView 和  mj_header文本 镜像冲突

    UICollectionView 和 mj_header文本 镜像冲突

    我的程序支持 阿拉伯语,它是镜像的,需要从右向左的布局。 如果我对UICollectionView进行镜像翻转成“从右向左”。 mj_header的label文字也会跟着二次翻转。 因为阿拉伯语会对mj_header进行一次翻转,UICollectionView翻转后,会再次二次翻转。 会造成镜像要“从右向左”,最终展示的结果为“从左向右”。

    我有一个阿拉伯语的国际化文件,你可以使用它。 ar.lproj.zip

    bug 
    opened by songyuyang0918 2
Releases(3.7.5)
  • 3.7.5(Nov 30, 2021)

    What's Changed

    • Fix/duplicated async method by @wolfcon in https://github.com/CoderMJLee/MJRefresh/pull/1560

    Full Changelog: https://github.com/CoderMJLee/MJRefresh/compare/3.7.4...3.7.5

    Source code(tar.gz)
    Source code(zip)
  • 3.7.4(Nov 30, 2021)

    What's Changed

    • Removed duplicated async method on main queue. by @wolfcon in https://github.com/CoderMJLee/MJRefresh/pull/1559

    Full Changelog: https://github.com/CoderMJLee/MJRefresh/compare/3.7.3...3.7.4

    Source code(tar.gz)
    Source code(zip)
  • 3.7.3(Nov 26, 2021)

    What's Changed

    • Fix issue #1533(StateTrailer title could not be changed immediately if setting) by @wolfcon in https://github.com/CoderMJLee/MJRefresh/pull/1536
    • Remove unnecessary definition in SPM. by @wolfcon in https://github.com/CoderMJLee/MJRefresh/pull/1544
    • [Example] Fixed navigation bar problem in iOS15 by @wolfcon in https://github.com/CoderMJLee/MJRefresh/pull/1553
    • Fixed a bug that footer(MJRefreshAutoFooter/MJRefreshBackFooter) movement behavior is weird when using performBatchUpdates method in UICollectionView by @jiasongs in https://github.com/CoderMJLee/MJRefresh/pull/1554
    • Reorder project workspace for framework and example. by @wolfcon in https://github.com/CoderMJLee/MJRefresh/pull/1555
    • Fixed the header updating issue when using setLastUpdatedTimeText block to update time label in first time. by @kkkelicheng in https://github.com/CoderMJLee/MJRefresh/pull/1404
    • Fixed misusage of initialize function by @wolfcon in https://github.com/CoderMJLee/MJRefresh/pull/1558

    Full Changelog: https://github.com/CoderMJLee/MJRefresh/compare/3.7.2...3.7.3

    Source code(tar.gz)
    Source code(zip)
  • 3.7.2(Jul 14, 2021)

  • 3.7.1(Jul 13, 2021)

    • SPM supported (#1470)
    • Fixed a bug that AutoStateFooter(Normal) couldn't call refresh method by tapping state label. It shouldn't be influenced by dragging logic. (#1529)
    • Add a new feature: MJRefresh components will be rerendered automatically with MJRefreshConfig.default.language setting. (#1527)
    Source code(tar.gz)
    Source code(zip)
  • 3.6.1(May 17, 2021)

  • 3.6.0(May 17, 2021)

    • Now animation duration can be changed. (set 0 to disable animtion) (#1503)
    • Providing a new method to disable all animation(setAnimationDisabled) [Specially for Bugs in UICollectionView] (#1503)
    • Add some Chaining grammar (#1499)
    • Remove deprecated code (#1498)
    Source code(tar.gz)
    Source code(zip)
  • 3.5.1(Aug 28, 2020)

  • 3.5.0(Aug 13, 2020)

  • 3.4.3(May 8, 2020)

  • 3.4.2(May 6, 2020)

  • 3.4.1(Apr 10, 2020)

    • Fix a problem that refresh header is still shown when calling ending command before refreshing animation finished.

    Please use header.isCollectionViewAnimationBug = true mode for more compatibility with collectionView.

    Source code(tar.gz)
    Source code(zip)
  • 3.4.0(Apr 10, 2020)

    • Add assert in label font property
    • Revert UIView Animation from CAAnimation. Now they are all existed, and selected by this trigger (isCollectionViewAnimationBug).
    Source code(tar.gz)
    Source code(zip)
  • 3.3.1(Dec 12, 2019)

  • 3.3.0(Dec 12, 2019)

    • lastUpdatedTimeText param should be nullable
    • Replace deprecated attributes method
    • Support attributed text width calculation for UILabel
    • AutoFooter will be performed like BackFooter if scrollView.pageEnabled = YES
    • Solve the mess between default animation and UIViewAnimation in UICollectionView
    Source code(tar.gz)
    Source code(zip)
  • 3.2.3(Nov 25, 2019)

  • 3.2.2(Oct 31, 2019)

    • 不通过停止刷新方案解决顶部栏 bug (停止刷新逻辑在切换 Window 时不做控制) (#1283)
    • 解决 iOS < 10 和 > 10 的顶部留空 bug 的区别对待
    • 加入带动画的刷新完成回调 (#698)
    • 修复自动刷新控件 AutoFooter及其子类 设置忽略距离 ignoredScrollViewContentInsetBottom 无效的问题(#852)
    • 增加俄/英地区本地化内容. (#1045)
    • 暴露 LoadingView 给外部 (#1288)
    • 修改在scrollview有偏移量时刷新内容位置不正确的问题 (#1293)
    • 默认关闭 Footer 多次触发加载的问题 (#1306)
    • 修复 BackNormalFooter 从刷新状态被设置为闲置状态动画结束后的过滤判断条件
    • 新增 Swift Optionals 支持
    • 修复在 iOS13 上使用自动布局导致的布局数据源异常问题 (#1353)
    • 支持 iOS 13 暗黑模式 (#1354)
    • 增加 WKWebView 上添加 GifHeader 的例子 (#1357)
    Source code(tar.gz)
    Source code(zip)
  • 3.2.1(May 6, 2019)

  • 3.1.17(May 6, 2019)

    • 主要修正正在刷新时切换控制器导致的顶部 Insets 异常的问题

    • 添加配置类, 用于修改默认配置, 暂时只加了语言选项 (#1232)

    • 增加韩语支持

    Source code(tar.gz)
    Source code(zip)
  • 3.1.15.6(Aug 20, 2018)

  • 3.1.15.1(Dec 11, 2017)

  • 3.1.15(Oct 28, 2017)

  • 3.1.14.1(Oct 20, 2017)

  • 3.1.14(Sep 28, 2017)

  • 3.1.13(Sep 27, 2017)

    1.Xcode9 Demo中的Xib、Storyboard适配 2.Demo顶部按钮的iPhoneX适配 3.iOS11适配 4.近几个月身体抱恙,故未及时更新,Sorry

    Source code(tar.gz)
    Source code(zip)
  • 3.1.12(Jul 23, 2016)

  • 3.1.11(Jul 22, 2016)

  • 3.1.10(Jul 6, 2016)

  • 3.1.9(Jun 22, 2016)

Owner
M了个J
CEO of The Seemygo.
M了个J
🧾 Flutter widget allowing easy cache-based data display in a ListView featuring pull-to-refresh and error banners.

Often, apps just display data fetched from some server. This package introduces the concept of fetchable streams. They are just like normal Streams, b

Marcel Garus 17 Jan 18, 2022
Flutter plugin for building pull to refresh effects with PullToRefreshNotification and PullToRefreshContainer quickly.

pull_to_refresh_notification Language: English | 中文简体 widget to build pull to refresh effects. Web demo for PullToRefreshNotification Chinese blog pul

FlutterCandies 165 Dec 28, 2022
GetX Architecture for large scale project, This project include - pagination, pull to refresh, localization, network call and advance error handling

GetX Architecture for large scale project, This project include - pagination, pull to refresh, localization, network call and advance error handling

Wai Han Ko 5 Nov 29, 2022
The EasyRichText widget provides an easy way to use RichText.

easy_rich_text The EasyRichText widget makes the RichText widget easy. You do not have to split the string manually. This widget use regular expressio

hans.huang 55 Jan 4, 2023
A package that gives us a modern way to show animated border as a placeholder while loading our widget with easy customization and ready to use.

A package that gives us a modern way to show animated border as a placeholder while loading our widget with easy customization and ready to use.

Mohit Chauhan 8 Oct 3, 2022
Boozin fitness - A sample app to that will pull data from Google Fit to get the steps count and calories burned

boozin_fitness A sample app to that will pull data from Google Fit to get the st

Abhishek Kumar Gupta 1 Nov 23, 2022
📖 A Guide for your first pull request

?? A Guide for your first pull request This project has been excluded by Hacktoberfest 2022 ✨ This project will help you to make your first pull reque

Dip Hire 27 Dec 2, 2022
A CLI tool to verify the test coverage of a pull request only, ignoring the rest of the project

This is a CI tool that analyzes the coverage rate of a pull request, ignoring the lines that were not changed in the PR. Motivation The coverage rate

Tales Barreto 3 Dec 15, 2022
The easiest way to create your animated splash screen in a fully customizable way.

Animated Splash Screen Check it out at Pub.Dev Do it your way Assets image Custom Widget Url image IconData Or just change PageTransition and/or Splas

Clean Code 104 Nov 10, 2022
A flutter widget to indicate loading progress. Easy to use, easy to extend

?? ?? ?? A flutter widget to indicate loading progress. Easy to use, easy to extend

Manuel Duarte 2 May 30, 2022
A TabBarController that is easy to use for flutter developers. 🥰 It supports various styles of page navigation, and you can also use it to customize your favorite styles. 🍻🍻

easy_tab_controller A user-friendly TabBarController widget for flutter developer. Getting Started This project is a starting point for a Flutter plug

圆号本昊 3 May 26, 2022
A Flutter package providing an easy way to add floating ribbon to images.

Floating Ribbon A new Flutter package for creating floating ribbons on images. Dependency dependencies: floating_ribbon: any How To Use In order to

101Loop 12 Sep 26, 2022
Lite version of smart_select package, zero dependencies, an easy way to provide a single or multiple choice chips.

Lite version of smart_select package, zero dependencies, an easy way to provide a single or multiple choice chips. What's New in Version 2.x.x Added p

Irfan Vigma Taufik 97 Dec 15, 2022
An easy way to add rounded corner floating app bar in Flutter project.

rounded_floating_app_bar Rounded floating app bar like new google applications has. This package provides an easy way to add rounded corner floating a

Bhavik Makwana 30 Nov 11, 2021
A package provides an easy way to add shimmer effect in Flutter project

flutter_shimmer_widget A package provides an easy way to add shimmer effect in Flutter project Getting Started Animation Example Project There is a ex

Le Anh Tuan 4 Jun 29, 2022
An easy way to show a flutter custom popup widget.

flutter_easy_popup An easy way to show a flutter custom popup widget. Screenshot Example Screenshot Dropdown Menu App Operation Guide Multi Highlights

BakerJ 42 Oct 26, 2022
An easy way to add all google ads to your flutter app.

Google Ads An easy way to add all google ads to your flutter app. How to use it Add the google_mobile_ads package using flutter pub add google_mobile_

Yemeni Open Source 4 Sep 27, 2022
[Flutter package] An easy and quick way to check if the local app is updated with the same version in their respective stores (Play Store / Apple Store ).

Retrieve version and url for local app update against store app Android and iOS Features Using as reference packages like in_app_update , version_chec

Kauê Murakami 11 Nov 9, 2022