Quellcode durchsuchen

即将废弃automaticllyHidden属性

即将废弃automaticllyHidden属性
M了个J vor 8 Jahren
Ursprung
Commit
22c8cb8f4e

+ 1 - 1
MJRefresh/Base/MJRefreshFooter.h

@@ -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

+ 0 - 11
MJRefresh/Base/MJRefreshFooter.m

@@ -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

+ 2 - 1
MJRefresh/Base/MJRefreshHeader.m

@@ -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;

+ 0 - 5
MJRefresh/UIScrollView+MJRefresh.h

@@ -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;

+ 10 - 0
MJRefresh/UIScrollView+MJRefresh.m

@@ -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];
@@ -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];