Răsfoiți Sursa

Specify platform version greater than or equal to iOS 8.0 (#1287)

* Specify platform greater than or equal to iOS 8.0
* Update demos and remove warnings
Kinarobin 6 ani în urmă
părinte
comite
f9423c0396
30 a modificat fișierele cu 64 adăugiri și 71 ștergeri
  1. 1 1
      MJRefresh.podspec
  2. 4 12
      MJRefresh/Base/MJRefreshComponent.m
  3. 0 16
      MJRefresh/Base/MJRefreshFooter.m
  4. 2 10
      MJRefresh/Custom/Header/MJRefreshStateHeader.m
  5. 2 2
      MJRefreshExample.xcodeproj/project.pbxproj
  6. 5 3
      MJRefreshExample/Base.lproj/Main.storyboard
  7. 4 4
      MJRefreshExample/Classes/Second/MJTestViewController.xib
  8. 4 4
      MJRefreshExample/Classes/Second/MJWebViewViewController.xib
  9. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/AppIcon@2x.png
  10. 40 17
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/Contents.json
  11. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ios-marketing-1024x1024.png
  12. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-20x20.png
  13. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-20x20@2x.png
  14. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-29x29-1.png
  15. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-29x29.png
  16. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-29x29@2x.png
  17. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-40x40.png
  18. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-40x40@2x.png
  19. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-76x76.png
  20. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-76x76@2x.png
  21. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-83.5x83.5@2x.png
  22. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-20x20@2x.png
  23. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-20x20@3x.png
  24. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-29x29@2x.png
  25. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-29x29@3x.png
  26. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-40x40@2x.png
  27. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-40x40@3x.png
  28. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-60x60@2x.png
  29. BIN
      MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-60x60@3x.png
  30. 2 2
      README.md

+ 1 - 1
MJRefresh.podspec

@@ -5,7 +5,7 @@ Pod::Spec.new do |s|
     s.homepage     = 'https://github.com/CoderMJLee/MJRefresh'
     s.license      = 'MIT'
     s.authors      = {'MJ Lee' => 'richermj123go@vip.qq.com'}
-    s.platform     = :ios, '6.0'
+    s.platform     = :ios, '8.0'
     s.source       = {:git => 'https://github.com/CoderMJLee/MJRefresh.git', :tag => s.version}
     s.source_files = 'MJRefresh/**/*.{h,m}'
     s.resource     = 'MJRefresh/MJRefresh.bundle'

+ 4 - 12
MJRefresh/Base/MJRefreshComponent.m

@@ -254,18 +254,10 @@ - (CGFloat)mj_textWidth {
     CGFloat stringWidth = 0;
     CGSize size = CGSizeMake(MAXFLOAT, MAXFLOAT);
     if (self.text.length > 0) {
-#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
-        stringWidth =[self.text
-                      boundingRectWithSize:size
-                      options:NSStringDrawingUsesLineFragmentOrigin
-                      attributes:@{NSFontAttributeName:self.font}
-                      context:nil].size.width;
-#else
-        
-        stringWidth = [self.text sizeWithFont:self.font
-                            constrainedToSize:size
-                                lineBreakMode:NSLineBreakByCharWrapping].width;
-#endif
+        stringWidth = [self.text boundingRectWithSize:size
+                                              options:NSStringDrawingUsesLineFragmentOrigin
+                                           attributes:@{NSFontAttributeName:self.font}
+                                              context:nil].size.width;
     }
     return stringWidth;
 }

+ 0 - 16
MJRefresh/Base/MJRefreshFooter.m

@@ -41,22 +41,6 @@ - (void)prepare
 //    self.automaticallyHidden = NO;
 }
 
-//- (void)willMoveToSuperview:(UIView *)newSuperview
-//{
-//    [super willMoveToSuperview:newSuperview];
-//
-//    if (newSuperview) {
-//        // 监听scrollView数据的变化
-//        if ([self.scrollView isKindOfClass:[UITableView class]] || [self.scrollView isKindOfClass:[UICollectionView class]]) {
-//            [self.scrollView setMj_reloadDataBlock:^(NSInteger totalDataCount) {
-//                if (self.isAutomaticallyHidden) {
-//                    self.hidden = (totalDataCount == 0);
-//                }
-//            }];
-//        }
-//    }
-//}
-
 #pragma mark - 公共方法
 - (void)endRefreshingWithNoMoreData
 {

+ 2 - 10
MJRefresh/Custom/Header/MJRefreshStateHeader.m

@@ -53,14 +53,6 @@ - (void)setTitle:(NSString *)title forState:(MJRefreshState)state
     self.stateLabel.text = self.stateTitles[@(self.state)];
 }
 
-#pragma mark - 日历获取在9.x之后的系统使用currentCalendar会出异常。在8.0之后使用系统新API。
-- (NSCalendar *)currentCalendar {
-    if ([NSCalendar respondsToSelector:@selector(calendarWithIdentifier:)]) {
-        return [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];
-    }
-    return [NSCalendar currentCalendar];
-}
-
 #pragma mark key的处理
 - (void)setLastUpdatedTimeKey:(NSString *)lastUpdatedTimeKey
 {
@@ -79,8 +71,8 @@ - (void)setLastUpdatedTimeKey:(NSString *)lastUpdatedTimeKey
     
     if (lastUpdatedTime) {
         // 1.获得年月日
-        NSCalendar *calendar = [self currentCalendar];
-        NSUInteger unitFlags = NSCalendarUnitYear| NSCalendarUnitMonth | NSCalendarUnitDay |NSCalendarUnitHour |NSCalendarUnitMinute;
+        NSCalendar *calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];
+        NSUInteger unitFlags = NSCalendarUnitYear| NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute;
         NSDateComponents *cmp1 = [calendar components:unitFlags fromDate:lastUpdatedTime];
         NSDateComponents *cmp2 = [calendar components:unitFlags fromDate:[NSDate date]];
         

+ 2 - 2
MJRefreshExample.xcodeproj/project.pbxproj

@@ -930,7 +930,7 @@
 				DEVELOPMENT_TEAM = "";
 				GCC_PREFIX_HEADER = MJRefreshExample/PrefixHeader.pch;
 				INFOPLIST_FILE = MJRefreshExample/Info.plist;
-				IPHONEOS_DEPLOYMENT_TARGET = 6.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = com.mj.MJRefresh;
 				PRODUCT_NAME = "$(TARGET_NAME)";
@@ -945,7 +945,7 @@
 				DEVELOPMENT_TEAM = "";
 				GCC_PREFIX_HEADER = MJRefreshExample/PrefixHeader.pch;
 				INFOPLIST_FILE = MJRefreshExample/Info.plist;
-				IPHONEOS_DEPLOYMENT_TARGET = 6.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = com.mj.MJRefresh;
 				PRODUCT_NAME = "$(TARGET_NAME)";

+ 5 - 3
MJRefreshExample/Base.lproj/Main.storyboard

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="06B-cM-i4B">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="06B-cM-i4B">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
     <dependencies>
-        <deployment version="1792" identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -53,6 +53,7 @@
                 <navigationController id="MBo-Zo-CjM" sceneMemberID="viewController">
                     <tabBarItem key="tabBarItem" title="Item" id="hIa-cL-CHu"/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="gXg-XT-JWK">
+                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     <connections>
@@ -169,6 +170,7 @@
                 <navigationController id="X1t-Y8-mVA" sceneMemberID="viewController">
                     <tabBarItem key="tabBarItem" title="Item" id="Dg6-YQ-9en"/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="mcw-Hk-IYU">
+                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     <connections>

+ 4 - 4
MJRefreshExample/Classes/Second/MJTestViewController.xib

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
     <dependencies>
-        <deployment version="1792" identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -16,7 +16,7 @@
         </placeholder>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
-            <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </view>

+ 4 - 4
MJRefreshExample/Classes/Second/MJWebViewViewController.xib

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
     <dependencies>
-        <deployment version="1792" identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -39,7 +39,7 @@
                     </connections>
                 </button>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="注意,这不是原生界面,是个网页:http://weibo.com/excepptions" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2VR-jQ-Qn4">
-                    <rect key="frame" x="146" y="459" width="208" height="31.5"/>
+                    <rect key="frame" x="146" y="459.5" width="208" height="31.5"/>
                     <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.16" colorSpace="custom" customColorSpace="sRGB"/>
                     <constraints>
                         <constraint firstAttribute="width" constant="208" id="qkq-G9-eo2"/>

BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/AppIcon@2x.png


+ 40 - 17
MJRefreshExample/Images.xcassets/AppIcon.appiconset/Contents.json

@@ -1,94 +1,117 @@
 {
   "images" : [
     {
-      "idiom" : "iphone",
       "size" : "20x20",
+      "idiom" : "iphone",
+      "filename" : "ipad-20x20@2x.png",
       "scale" : "2x"
     },
     {
-      "idiom" : "iphone",
       "size" : "20x20",
+      "idiom" : "iphone",
+      "filename" : "iphone-20x20@3x.png",
       "scale" : "3x"
     },
     {
+      "size" : "29x29",
       "idiom" : "iphone",
+      "filename" : "ipad-29x29.png",
+      "scale" : "1x"
+    },
+    {
       "size" : "29x29",
+      "idiom" : "iphone",
+      "filename" : "ipad-29x29@2x.png",
       "scale" : "2x"
     },
     {
-      "idiom" : "iphone",
       "size" : "29x29",
+      "idiom" : "iphone",
+      "filename" : "iphone-29x29@3x.png",
       "scale" : "3x"
     },
     {
-      "idiom" : "iphone",
       "size" : "40x40",
+      "idiom" : "iphone",
+      "filename" : "ipad-40x40@2x.png",
       "scale" : "2x"
     },
     {
-      "idiom" : "iphone",
       "size" : "40x40",
+      "idiom" : "iphone",
+      "filename" : "iphone-40x40@3x.png",
       "scale" : "3x"
     },
     {
       "size" : "60x60",
       "idiom" : "iphone",
-      "filename" : "AppIcon@2x.png",
+      "filename" : "iphone-60x60@2x.png",
       "scale" : "2x"
     },
     {
-      "idiom" : "iphone",
       "size" : "60x60",
+      "idiom" : "iphone",
+      "filename" : "iphone-60x60@3x.png",
       "scale" : "3x"
     },
     {
-      "idiom" : "ipad",
       "size" : "20x20",
+      "idiom" : "ipad",
+      "filename" : "ipad-20x20.png",
       "scale" : "1x"
     },
     {
-      "idiom" : "ipad",
       "size" : "20x20",
+      "idiom" : "ipad",
+      "filename" : "iphone-20x20@2x.png",
       "scale" : "2x"
     },
     {
-      "idiom" : "ipad",
       "size" : "29x29",
+      "idiom" : "ipad",
+      "filename" : "ipad-29x29-1.png",
       "scale" : "1x"
     },
     {
-      "idiom" : "ipad",
       "size" : "29x29",
+      "idiom" : "ipad",
+      "filename" : "iphone-29x29@2x.png",
       "scale" : "2x"
     },
     {
-      "idiom" : "ipad",
       "size" : "40x40",
+      "idiom" : "ipad",
+      "filename" : "ipad-40x40.png",
       "scale" : "1x"
     },
     {
-      "idiom" : "ipad",
       "size" : "40x40",
+      "idiom" : "ipad",
+      "filename" : "iphone-40x40@2x.png",
       "scale" : "2x"
     },
     {
-      "idiom" : "ipad",
       "size" : "76x76",
+      "idiom" : "ipad",
+      "filename" : "ipad-76x76.png",
       "scale" : "1x"
     },
     {
-      "idiom" : "ipad",
       "size" : "76x76",
+      "idiom" : "ipad",
+      "filename" : "ipad-76x76@2x.png",
       "scale" : "2x"
     },
     {
-      "idiom" : "ipad",
       "size" : "83.5x83.5",
+      "idiom" : "ipad",
+      "filename" : "ipad-83.5x83.5@2x.png",
       "scale" : "2x"
     },
     {
-      "idiom" : "ios-marketing",
       "size" : "1024x1024",
+      "idiom" : "ios-marketing",
+      "filename" : "ios-marketing-1024x1024.png",
       "scale" : "1x"
     }
   ],

BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ios-marketing-1024x1024.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-20x20.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-20x20@2x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-29x29-1.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-29x29.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-29x29@2x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-40x40.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-40x40@2x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-76x76.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-76x76@2x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/ipad-83.5x83.5@2x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-20x20@2x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-20x20@3x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-29x29@2x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-29x29@3x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-40x40@2x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-40x40@3x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-60x60@2x.png


BIN
MJRefreshExample/Images.xcassets/AppIcon.appiconset/iphone-60x60@3x.png


+ 2 - 2
README.md

@@ -345,7 +345,7 @@ self.webView.scrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingB
 
 ## Remind
 * ARC
-* iOS>=6.0
+* iOS>=8.0
 * iPhone \ iPad screen anyway
 
 ## <a id="Hope"></a>Hope
@@ -368,4 +368,4 @@ self.webView.scrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingB
 - 因本人工作忙,没有太多时间去维护MJRefresh,在此向广大框架使用者说声:非常抱歉!😞
 - 现寻求志同道合的小伙伴一起维护此框架,有兴趣的小伙伴可以[发邮件](mailto:richermj123go@vip.qq.com)给我,非常感谢😊
 - 如果一切OK,我将开放框架维护权限(github、pod等)
-- 目前已经找到3位小伙伴(^-^)V
+- 目前已经找到3位小伙伴(^-^)V