Skip to content

Commit

Permalink
remove @available and warnings
Browse files Browse the repository at this point in the history
1.remove @available
2.remove warnings
3.fix block parameters
  • Loading branch information
520dev committed Oct 19, 2017
1 parent 1db7917 commit 4833dca
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion MJRefresh.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MJRefresh'
s.version = '3.1.14'
s.version = '3.1.14.1'
s.summary = 'An easy way to use pull-to-refresh'
s.homepage = 'https://github.com/CoderMJLee/MJRefresh'
s.license = 'MIT'
Expand Down
10 changes: 5 additions & 5 deletions MJRefresh/Base/MJRefreshComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ typedef NS_ENUM(NSInteger, MJRefreshState) {
};

/** 进入刷新状态的回调 */
typedef void (^MJRefreshComponentRefreshingBlock)();
typedef void (^MJRefreshComponentRefreshingBlock)(void);
/** 开始刷新后的回调(进入刷新状态后的回调) */
typedef void (^MJRefreshComponentbeginRefreshingCompletionBlock)();
typedef void (^MJRefreshComponentbeginRefreshingCompletionBlock)(void);
/** 结束刷新后的回调 */
typedef void (^MJRefreshComponentEndRefreshingCompletionBlock)();
typedef void (^MJRefreshComponentEndRefreshingCompletionBlock)(void);

/** 刷新控件的基类 */
@interface MJRefreshComponent : UIView
Expand All @@ -59,14 +59,14 @@ typedef void (^MJRefreshComponentEndRefreshingCompletionBlock)();
#pragma mark - 刷新状态控制
/** 进入刷新状态 */
- (void)beginRefreshing;
- (void)beginRefreshingWithCompletionBlock:(void (^)())completionBlock;
- (void)beginRefreshingWithCompletionBlock:(void (^)(void))completionBlock;
/** 开始刷新后的回调(进入刷新状态后的回调) */
@property (copy, nonatomic) MJRefreshComponentbeginRefreshingCompletionBlock beginRefreshingCompletionBlock;
/** 结束刷新的回调 */
@property (copy, nonatomic) MJRefreshComponentEndRefreshingCompletionBlock endRefreshingCompletionBlock;
/** 结束刷新状态 */
- (void)endRefreshing;
- (void)endRefreshingWithCompletionBlock:(void (^)())completionBlock;
- (void)endRefreshingWithCompletionBlock:(void (^)(void))completionBlock;
/** 是否正在刷新 */
@property (assign, nonatomic, readonly, getter=isRefreshing) BOOL refreshing;
//- (BOOL)isRefreshing;
Expand Down
4 changes: 2 additions & 2 deletions MJRefresh/Base/MJRefreshComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ - (void)beginRefreshing
}
}

- (void)beginRefreshingWithCompletionBlock:(void (^)())completionBlock
- (void)beginRefreshingWithCompletionBlock:(void (^)(void))completionBlock
{
self.beginRefreshingCompletionBlock = completionBlock;

Expand All @@ -174,7 +174,7 @@ - (void)endRefreshing
self.state = MJRefreshStateIdle;
}

- (void)endRefreshingWithCompletionBlock:(void (^)())completionBlock
- (void)endRefreshingWithCompletionBlock:(void (^)(void))completionBlock
{
self.endRefreshingCompletionBlock = completionBlock;

Expand Down
15 changes: 9 additions & 6 deletions MJRefresh/UIScrollView+MJExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
#import "UIScrollView+MJExtension.h"
#import <objc/runtime.h>

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_GREATER_NOT_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability-new"

@implementation UIScrollView (MJExtension)

- (UIEdgeInsets)mj_inset
{
#ifdef __IPHONE_11_0
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) {
return self.adjustedContentInset;
}
#endif
Expand All @@ -30,7 +32,7 @@ - (void)setMj_insetT:(CGFloat)mj_insetT
UIEdgeInsets inset = self.contentInset;
inset.top = mj_insetT;
#ifdef __IPHONE_11_0
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) {
inset.top -= (self.adjustedContentInset.top - self.contentInset.top);
}
#endif
Expand All @@ -47,7 +49,7 @@ - (void)setMj_insetB:(CGFloat)mj_insetB
UIEdgeInsets inset = self.contentInset;
inset.bottom = mj_insetB;
#ifdef __IPHONE_11_0
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) {
inset.bottom -= (self.adjustedContentInset.bottom - self.contentInset.bottom);
}
#endif
Expand All @@ -64,7 +66,7 @@ - (void)setMj_insetL:(CGFloat)mj_insetL
UIEdgeInsets inset = self.contentInset;
inset.left = mj_insetL;
#ifdef __IPHONE_11_0
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) {
inset.left -= (self.adjustedContentInset.left - self.contentInset.left);
}
#endif
Expand All @@ -81,7 +83,7 @@ - (void)setMj_insetR:(CGFloat)mj_insetR
UIEdgeInsets inset = self.contentInset;
inset.right = mj_insetR;
#ifdef __IPHONE_11_0
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
if (SYSTEM_VERSION_GREATER_NOT_LESS_THAN(@"11.0")) {
inset.right -= (self.adjustedContentInset.right - self.contentInset.right);
}
#endif
Expand Down Expand Up @@ -141,3 +143,4 @@ - (CGFloat)mj_contentH
return self.contentSize.height;
}
@end
#pragma clang diagnostic pop
2 changes: 1 addition & 1 deletion MJRefreshExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
2D9DF47B1F7CE2F90042D6DD /* MJRefreshNormalHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA0A1BECBE6700D58F6A /* MJRefreshNormalHeader.m */; };
2D9DF47C1F7CE2F90042D6DD /* MJRefreshStateHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA0C1BECBE6700D58F6A /* MJRefreshStateHeader.m */; };
2D9DF47D1F7CE2F90042D6DD /* MJRefreshConst.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA101BECBE6700D58F6A /* MJRefreshConst.m */; };
2D9DF47E1F7CE2F90042D6DD /* UIScrollView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA121BECBE6700D58F6A /* UIScrollView+MJExtension.m */; };
2D9DF47E1F7CE2F90042D6DD /* UIScrollView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA121BECBE6700D58F6A /* UIScrollView+MJExtension.m */; settings = {COMPILER_FLAGS = "-Wno-unguarded-availability-new"; }; };
2D9DF47F1F7CE2F90042D6DD /* UIScrollView+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA141BECBE6700D58F6A /* UIScrollView+MJRefresh.m */; };
2D9DF4801F7CE2F90042D6DD /* UIView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DB2EA161BECBE6700D58F6A /* UIView+MJExtension.m */; };
2D9DF4811F7CE2F90042D6DD /* NSBundle+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D4698851D0EE6A400CB8025 /* NSBundle+MJRefresh.m */; };
Expand Down

0 comments on commit 4833dca

Please sign in to comment.