Skip to content

Commit

Permalink
即将废弃automaticllyHidden属性
Browse files Browse the repository at this point in the history
即将废弃automaticllyHidden属性
  • Loading branch information
520dev committed Dec 11, 2017
1 parent 93da801 commit 22c8cb8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion MJRefresh/Base/MJRefreshFooter.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetBottom;

/** 自动根据有无数据来显示和隐藏(有数据就显示,没有数据隐藏。默认是NO) */
@property (assign, nonatomic, getter=isAutomaticallyHidden) BOOL automaticallyHidden;
@property (assign, nonatomic, getter=isAutomaticallyHidden) BOOL automaticallyHidden MJRefreshDeprecated("不建议使用此属性,开发者请自行控制footer的显示和隐藏。基于安全考虑,在未来的某些版本此属性可能作废");
@end
11 changes: 0 additions & 11 deletions MJRefresh/Base/MJRefreshFooter.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,5 @@ - (void)resetNoMoreData
- (void)setAutomaticallyHidden:(BOOL)automaticallyHidden
{
_automaticallyHidden = automaticallyHidden;

if (automaticallyHidden) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[UITableView exchangeInstanceMethod1:@selector(reloadData) method2:@selector(mj_reloadData)];
[UICollectionView exchangeInstanceMethod1:@selector(reloadData) method2:@selector(mj_reloadData)];
});
#pragma clang diagnostic pop
}
}
@end
3 changes: 2 additions & 1 deletion MJRefresh/Base/MJRefreshHeader.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change

// 在刷新的refreshing状态
if (self.state == MJRefreshStateRefreshing) {
// if (self.window == nil) return;
// 暂时保留
if (self.window == nil) return;

// sectionheader停留解决
CGFloat insetT = - self.scrollView.mj_offsetY > _scrollViewOriginalInset.top ? - self.scrollView.mj_offsetY : _scrollViewOriginalInset.top;
Expand Down
5 changes: 0 additions & 5 deletions MJRefresh/UIScrollView+MJRefresh.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

@class MJRefreshHeader, MJRefreshFooter;

@interface NSObject (MJRefresh)
+ (void)exchangeInstanceMethod1:(SEL)method1 method2:(SEL)method2;
+ (void)exchangeClassMethod1:(SEL)method1 method2:(SEL)method2;
@end

@interface UIScrollView (MJRefresh)
/** 下拉刷新控件 */
@property (strong, nonatomic) MJRefreshHeader *mj_header;
Expand Down
10 changes: 10 additions & 0 deletions MJRefresh/UIScrollView+MJRefresh.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ - (void)executeReloadDataBlock

@implementation UITableView (MJRefresh)

+ (void)load
{
[self exchangeInstanceMethod1:@selector(reloadData) method2:@selector(mj_reloadData)];
}

- (void)mj_reloadData
{
[self mj_reloadData];
Expand All @@ -144,6 +149,11 @@ - (void)mj_reloadData

@implementation UICollectionView (MJRefresh)

+ (void)load
{
[self exchangeInstanceMethod1:@selector(reloadData) method2:@selector(mj_reloadData)];
}

- (void)mj_reloadData
{
[self mj_reloadData];
Expand Down

0 comments on commit 22c8cb8

Please sign in to comment.