Skip to content

Commit

Permalink
修改检查系统版本的方法,移除 @available 关键字
Browse files Browse the repository at this point in the history
  • Loading branch information
russellyi committed Oct 18, 2017
1 parent 5716324 commit 1db7917
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions MJRefresh/UIScrollView+MJExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
#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)


@implementation UIScrollView (MJExtension)

- (UIEdgeInsets)mj_inset
{
#ifdef __IPHONE_11_0
if(@available(iOS 11.0, *)){
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
return self.adjustedContentInset;
}
#endif
Expand All @@ -27,7 +30,7 @@ - (void)setMj_insetT:(CGFloat)mj_insetT
UIEdgeInsets inset = self.contentInset;
inset.top = mj_insetT;
#ifdef __IPHONE_11_0
if(@available(iOS 11.0, *)){
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
inset.top -= (self.adjustedContentInset.top - self.contentInset.top);
}
#endif
Expand All @@ -44,7 +47,7 @@ - (void)setMj_insetB:(CGFloat)mj_insetB
UIEdgeInsets inset = self.contentInset;
inset.bottom = mj_insetB;
#ifdef __IPHONE_11_0
if(@available(iOS 11.0, *)){
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
inset.bottom -= (self.adjustedContentInset.bottom - self.contentInset.bottom);
}
#endif
Expand All @@ -61,7 +64,7 @@ - (void)setMj_insetL:(CGFloat)mj_insetL
UIEdgeInsets inset = self.contentInset;
inset.left = mj_insetL;
#ifdef __IPHONE_11_0
if(@available(iOS 11.0, *)){
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
inset.left -= (self.adjustedContentInset.left - self.contentInset.left);
}
#endif
Expand All @@ -78,7 +81,7 @@ - (void)setMj_insetR:(CGFloat)mj_insetR
UIEdgeInsets inset = self.contentInset;
inset.right = mj_insetR;
#ifdef __IPHONE_11_0
if(@available(iOS 11.0, *)){
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
inset.right -= (self.adjustedContentInset.right - self.contentInset.right);
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D9DF4511F7CE29B0042D6DD"
BuildableName = "MJRefreshFramework.framework"
BuildableName = "MJRefresh.framework"
BlueprintName = "MJRefreshFramework"
ReferencedContainer = "container:MJRefreshExample.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -48,7 +48,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D9DF4511F7CE29B0042D6DD"
BuildableName = "MJRefreshFramework.framework"
BuildableName = "MJRefresh.framework"
BlueprintName = "MJRefreshFramework"
ReferencedContainer = "container:MJRefreshExample.xcodeproj">
</BuildableReference>
Expand All @@ -66,7 +66,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D9DF4511F7CE29B0042D6DD"
BuildableName = "MJRefreshFramework.framework"
BuildableName = "MJRefresh.framework"
BlueprintName = "MJRefreshFramework"
ReferencedContainer = "container:MJRefreshExample.xcodeproj">
</BuildableReference>
Expand Down

0 comments on commit 1db7917

Please sign in to comment.