From c387725ad7200a1bff2929fddf16cc084208726d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=86=8B=E6=BA=9C=E8=8D=89=E8=8E=93=E4=BE=BF=E5=BD=93?= <410236056@qq.com> Date: Tue, 8 May 2018 17:02:09 +0800 Subject: [PATCH 01/19] fix tableview on the MXScrollView if tableview on the MXScrollView, Sometimes clicking on cell is invalid --- MXParallaxHeader/MXScrollView.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MXParallaxHeader/MXScrollView.m b/MXParallaxHeader/MXScrollView.m index ab29a90..b731674 100644 --- a/MXParallaxHeader/MXScrollView.m +++ b/MXParallaxHeader/MXScrollView.m @@ -123,6 +123,10 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecogni if ([scrollView.superview isKindOfClass:[UITableView class]]) { return NO; } + //tableview on the MXScrollView + if ([scrollView.superview isKindOfClass:NSClassFromString(@"UITableViewCellContentView")]) { + return NO; + } BOOL shouldScroll = YES; if ([self.delegate respondsToSelector:@selector(scrollView:shouldScrollWithSubView:)]) { From 1869b82a6846e5c5c5a8460050c88766e568a123 Mon Sep 17 00:00:00 2001 From: maxep Date: Thu, 9 May 2019 21:15:44 +0200 Subject: [PATCH 02/19] Xcode 10.2 --- .travis.yml | 6 +- .../AppIcon.appiconset/Contents.json | 5 + .../LaunchImage.launchimage/Contents.json | 51 ------ Example-objc/Base.lproj/Main.storyboard | 72 ++++----- .../MXScrollView/MXScrollViewExample.m | 2 +- Example-swift/AppDelegate.swift | 2 +- .../LaunchImage.launchimage/Contents.json | 150 ------------------ Example-swift/Base.lproj/Main.storyboard | 72 ++++----- Example-swift/MXFalconViewController.swift | 7 +- Example-swift/MXScrollViewExample.swift | 6 +- Example-swift/UIScrollViewExample.swift | 2 +- MXParallaxHeader.podspec | 2 +- MXParallaxHeader.xcodeproj/project.pbxproj | 26 +-- .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcschemes/MXParallaxHeader.xcscheme | 4 +- 15 files changed, 112 insertions(+), 303 deletions(-) delete mode 100755 Example-objc/Assets.xcassets/LaunchImage.launchimage/Contents.json delete mode 100644 Example-swift/Assets.xcassets/LaunchImage.launchimage/Contents.json create mode 100644 MXParallaxHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/.travis.yml b/.travis.yml index f371479..03011ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode9 +osx_image: xcode10.2 env: global: - FRAMEWORK_NAME=MXParallaxHeader @@ -8,9 +8,9 @@ before_install: - brew outdated carthage || brew upgrade carthage install: - gem install cocoapods -- gem install xcpretty --no-rdoc --no-ri --no-document --quiet +- gem install xcpretty --no-document --quiet script: -- set -o pipefail && xcodebuild -project MXParallaxHeader.xcodeproj -scheme $FRAMEWORK_NAME -sdk iphonesimulator11.0 -configuration Release | xcpretty -c +- set -o pipefail && xcodebuild -project MXParallaxHeader.xcodeproj -scheme $FRAMEWORK_NAME -sdk iphonesimulator12.2 -configuration Release | xcpretty -c - pod lib lint --quick before_deploy: - carthage build --no-skip-current diff --git a/Example-objc/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example-objc/Assets.xcassets/AppIcon.appiconset/Contents.json index 1d060ed..d8db8d6 100755 --- a/Example-objc/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example-objc/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -84,6 +84,11 @@ "idiom" : "ipad", "size" : "83.5x83.5", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/Example-objc/Assets.xcassets/LaunchImage.launchimage/Contents.json b/Example-objc/Assets.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100755 index 4458b40..0000000 --- a/Example-objc/Assets.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "subtype" : "retina4", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/Example-objc/Base.lproj/Main.storyboard b/Example-objc/Base.lproj/Main.storyboard index b5ff5f2..38a3c32 100755 --- a/Example-objc/Base.lproj/Main.storyboard +++ b/Example-objc/Base.lproj/Main.storyboard @@ -1,10 +1,12 @@ - - + + + + + - - - + + @@ -13,20 +15,20 @@ - + - + - + @@ -84,14 +90,11 @@ - - - - - + + @@ -115,14 +118,11 @@ - - - - - + + @@ -135,16 +135,15 @@ - - - - - + + + + @@ -156,10 +155,11 @@ - - - + + + + @@ -176,7 +176,7 @@ - + @@ -197,25 +197,23 @@ - - - - - + + - - - + + + + diff --git a/Example-objc/MXScrollView/MXScrollViewExample.m b/Example-objc/MXScrollView/MXScrollViewExample.m index 377209b..5935352 100755 --- a/Example-objc/MXScrollView/MXScrollViewExample.m +++ b/Example-objc/MXScrollView/MXScrollViewExample.m @@ -56,7 +56,7 @@ - (void)viewDidAppear:(BOOL)animated { // In this example I use manual layout for peformances - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; - CGRect frame = self.view.frame; + CGRect frame = self.view.bounds; //Update scroll view frame and content size self.scrollView.frame = frame; diff --git a/Example-swift/AppDelegate.swift b/Example-swift/AppDelegate.swift index f152ff3..1bd1814 100644 --- a/Example-swift/AppDelegate.swift +++ b/Example-swift/AppDelegate.swift @@ -27,7 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { UITabBar.appearance().tintColor = #colorLiteral(red: 0.5921568627, green: 0.2588235294, blue: 0.2666666667, alpha: 1) // #974244 return true diff --git a/Example-swift/Assets.xcassets/LaunchImage.launchimage/Contents.json b/Example-swift/Assets.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index ce3fb1a..0000000 --- a/Example-swift/Assets.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "landscape", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "667h", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "1366h", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-swift/Base.lproj/Main.storyboard b/Example-swift/Base.lproj/Main.storyboard index e9deaf4..17911cb 100644 --- a/Example-swift/Base.lproj/Main.storyboard +++ b/Example-swift/Base.lproj/Main.storyboard @@ -1,10 +1,12 @@ - - + + + + + - - - + + @@ -13,20 +15,20 @@ - + - + - + @@ -84,14 +90,11 @@ - - - - - + + @@ -115,14 +118,11 @@ - - - - - + + @@ -136,7 +136,7 @@ - + @@ -157,25 +157,23 @@ - - - - - + + - - - + + + + @@ -227,16 +225,15 @@ - - - - - + + + + @@ -247,11 +244,12 @@ - + - - + + + diff --git a/Example-swift/MXFalconViewController.swift b/Example-swift/MXFalconViewController.swift index b9ec87c..3391587 100644 --- a/Example-swift/MXFalconViewController.swift +++ b/Example-swift/MXFalconViewController.swift @@ -32,16 +32,11 @@ class MXFalconViewController: UIViewController, MXParallaxHeaderDelegate { parallaxHeader?.delegate = self } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. - } // MARK: - MXParallaxHeaderDelegate func parallaxHeaderDidScroll(_ parallaxHeader: MXParallaxHeader) { - let angle = parallaxHeader.progress * CGFloat(M_PI) * 2 + let angle = parallaxHeader.progress * CGFloat(Double.pi) * 2 self.falcon.transform = CGAffineTransform.identity.rotated(by: angle) } diff --git a/Example-swift/MXScrollViewExample.swift b/Example-swift/MXScrollViewExample.swift index e0ea76e..6f448e1 100644 --- a/Example-swift/MXScrollViewExample.swift +++ b/Example-swift/MXScrollViewExample.swift @@ -38,7 +38,7 @@ class MXScrollViewExample: UIViewController, UITableViewDelegate, UITableViewDat scrollView = MXScrollView() scrollView.parallaxHeader.view = Bundle.main.loadNibNamed("StarshipHeader", owner: self, options: nil)?.first as? UIView // You can set the parallax header view from a nib. scrollView.parallaxHeader.height = 300 - scrollView.parallaxHeader.mode = MXParallaxHeaderMode.fill + scrollView.parallaxHeader.mode = .fill view.addSubview(scrollView) table1 = UITableView() @@ -61,7 +61,7 @@ class MXScrollViewExample: UIViewController, UITableViewDelegate, UITableViewDat override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() - var frame = view.frame + var frame = view.bounds scrollView.frame = frame scrollView.contentSize = frame.size @@ -85,7 +85,7 @@ class MXScrollViewExample: UIViewController, UITableViewDelegate, UITableViewDat var cell = tableView.dequeueReusableCell(withIdentifier: CellIdentifier) if (cell == nil) { - cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: CellIdentifier) + cell = UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: CellIdentifier) } cell!.textLabel!.text = String(format: "Row %ld", indexPath.row * 10) cell!.backgroundColor = SpanichWhite; diff --git a/Example-swift/UIScrollViewExample.swift b/Example-swift/UIScrollViewExample.swift index 0313a40..49cc4fc 100644 --- a/Example-swift/UIScrollViewExample.swift +++ b/Example-swift/UIScrollViewExample.swift @@ -33,7 +33,7 @@ class UIScrollViewExample: UITableViewController, MXParallaxHeaderDelegate { // Parallax Header tableView.parallaxHeader.view = headerView // You can set the parallax header view from the floating view tableView.parallaxHeader.height = 300 - tableView.parallaxHeader.mode = MXParallaxHeaderMode.fill + tableView.parallaxHeader.mode = .fill tableView.parallaxHeader.delegate = self } diff --git a/MXParallaxHeader.podspec b/MXParallaxHeader.podspec index 331b8a1..505cec6 100644 --- a/MXParallaxHeader.podspec +++ b/MXParallaxHeader.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/maxep/MXParallaxHeader.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/MaximeEpain' - s.platform = :ios, '7.0' + s.platform = :ios, '8.0' s.requires_arc = true s.source_files = 'MXParallaxHeader/*.{m,h}' diff --git a/MXParallaxHeader.xcodeproj/project.pbxproj b/MXParallaxHeader.xcodeproj/project.pbxproj index 66a1311..6ddb905 100644 --- a/MXParallaxHeader.xcodeproj/project.pbxproj +++ b/MXParallaxHeader.xcodeproj/project.pbxproj @@ -361,7 +361,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = maxep; TargetAttributes = { 9C01BC6E1DA3E4D40032494C = { @@ -378,14 +378,14 @@ 9C01BCC71DA3E9A80032494C = { CreatedOnToolsVersion = 8.0; DevelopmentTeam = C75GEDTP26; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = 9C01BC691DA3E4D40032494C /* Build configuration list for PBXProject "MXParallaxHeader" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -526,6 +526,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -535,6 +536,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -542,6 +544,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -584,6 +587,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -593,6 +597,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -600,6 +605,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -645,6 +651,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Framework/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = Framework/module.modulemap; PRODUCT_BUNDLE_IDENTIFIER = fr.maxep.MXParallaxHeader; @@ -667,6 +674,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Framework/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = Framework/module.modulemap; PRODUCT_BUNDLE_IDENTIFIER = fr.maxep.MXParallaxHeader; @@ -680,9 +688,9 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEVELOPMENT_TEAM = C75GEDTP26; INFOPLIST_FILE = "$(SRCROOT)/Example-objc/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "fr.maxep.MXParallaxHeader-objc"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -693,9 +701,9 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEVELOPMENT_TEAM = C75GEDTP26; INFOPLIST_FILE = "$(SRCROOT)/Example-objc/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "fr.maxep.MXParallaxHeader-objc"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -706,15 +714,15 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEVELOPMENT_TEAM = C75GEDTP26; INFOPLIST_FILE = "$(SRCROOT)/Example-swift/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "fr.maxep.MXParallaxHeader-swift"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -722,14 +730,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEVELOPMENT_TEAM = C75GEDTP26; INFOPLIST_FILE = "$(SRCROOT)/Example-swift/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "fr.maxep.MXParallaxHeader-swift"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/MXParallaxHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/MXParallaxHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/MXParallaxHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/MXParallaxHeader.xcscheme b/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/MXParallaxHeader.xcscheme index a0363a0..24a4c15 100644 --- a/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/MXParallaxHeader.xcscheme +++ b/MXParallaxHeader.xcodeproj/xcshareddata/xcschemes/MXParallaxHeader.xcscheme @@ -1,6 +1,6 @@ @@ -37,7 +36,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" From 1446aef78a4c770c9611516d7bbd83e621997534 Mon Sep 17 00:00:00 2001 From: lexiaoyao20 <455295813@qq.com> Date: Sun, 2 Sep 2018 16:38:26 +0800 Subject: [PATCH 03/19] Supporting WKWebView --- MXParallaxHeader/MXScrollView.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MXParallaxHeader/MXScrollView.m b/MXParallaxHeader/MXScrollView.m index b731674..88bfd03 100644 --- a/MXParallaxHeader/MXScrollView.m +++ b/MXParallaxHeader/MXScrollView.m @@ -112,12 +112,17 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecogni return NO; } + UIView *otherView = otherGestureRecognizer.view; + // WKWebView on he MXScrollView + if ([otherView isKindOfClass:NSClassFromString(@"WKContentView")]) { + otherView = otherView.superview; + } // Consider scroll view pan only - if (![otherGestureRecognizer.view isKindOfClass:[UIScrollView class]]) { + if (![otherView isKindOfClass:[UIScrollView class]]) { return NO; } - UIScrollView *scrollView = (id)otherGestureRecognizer.view; + UIScrollView *scrollView = (id)otherView; // Tricky case: UITableViewWrapperView if ([scrollView.superview isKindOfClass:[UITableView class]]) { From 879db7f9a649a7447c5ef5d4461ac2697fe40c60 Mon Sep 17 00:00:00 2001 From: maxep Date: Thu, 9 May 2019 21:51:57 +0200 Subject: [PATCH 04/19] Update README --- README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6897f0c..284ff59 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![License](https://img.shields.io/cocoapods/l/MXParallaxHeader.svg?style=flat)](http://cocoapods.org/pods/MXParallaxHeader) [![Platform](https://img.shields.io/cocoapods/p/MXParallaxHeader.svg?style=flat)](http://cocoapods.org/pods/MXParallaxHeader) -MXParallaxHeader is a simple header class for UIScrolView. +MXParallaxHeader is a simple header class for UIScrollView. In addition, MXScrollView is a UIScrollView subclass with the ability to hook the vertical scroll from its subviews, this can be used to add a parallax header to complex view hierachy. Moreover, MXScrollViewController allows you to add a MXParallaxHeader to any kind of UIViewController. @@ -24,17 +24,38 @@ pod try MXParallaxHeader + Adding a parallax header to a UIScrollView is straightforward, e.g: +
+Swift + +```swift +let headerView = UIImageView() +headerView.image = UIImage(named: "success-baby") +headerView.contentMode = .scaleAspectFit + +let scrollView = UIScrollView() +scrollView.parallaxHeader.view = headerView +scrollView.parallaxHeader.height = 150 +scrollView.parallaxHeader.mode = .fill +scrollView.parallaxHeader.minimumHeight = 20 +``` +
+ +
+Objective-C + ```objective-c UIImageView *headerView = [UIImageView new]; headerView.image = [UIImage imageNamed:@"success-baby"]; headerView.contentMode = UIViewContentModeScaleAspectFill; - + UIScrollView *scrollView = [UIScrollView new]; scrollView.parallaxHeader.view = headerView; scrollView.parallaxHeader.height = 150; scrollView.parallaxHeader.mode = MXParallaxHeaderModeFill; scrollView.parallaxHeader.minimumHeight = 20; ``` +
+ + The MXScrollViewController is a container with a child view controller that can be added programmatically or using the custom segue MXScrollViewControllerSegue. From 146b636f5fb2426744e5e3546e76fb0ccf2d35f0 Mon Sep 17 00:00:00 2001 From: maxep Date: Fri, 10 May 2019 13:58:57 +0200 Subject: [PATCH 05/19] Load parallax header from nib --- MXParallaxHeader/MXParallaxHeader.h | 9 +++++++++ MXParallaxHeader/MXParallaxHeader.m | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/MXParallaxHeader/MXParallaxHeader.h b/MXParallaxHeader/MXParallaxHeader.h index 60373ff..03dcad3 100644 --- a/MXParallaxHeader/MXParallaxHeader.h +++ b/MXParallaxHeader/MXParallaxHeader.h @@ -92,6 +92,15 @@ typedef NS_ENUM(NSInteger, MXParallaxHeaderMode) { */ @property (nonatomic,readonly) CGFloat progress; +/** + Loads a `view` from the nib file in the specified bundle. + + @param name The name of the nib file, without any leading path information. + @param bundleOrNil The bundle in which to search for the nib file. If you specify nil, this method looks for the nib file in the main bundle. + @param optionsOrNil A dictionary containing the options to use when opening the nib file. For a list of available keys for this dictionary, see NSBundle UIKit Additions. + */ +- (void)loadWithNibName:(NSString *)name bundle:(nullable NSBundle *)bundleOrNil options:(nullable NSDictionary *)optionsOrNil; + @end /** diff --git a/MXParallaxHeader/MXParallaxHeader.m b/MXParallaxHeader/MXParallaxHeader.m index 29c79e0..1818d34 100644 --- a/MXParallaxHeader/MXParallaxHeader.m +++ b/MXParallaxHeader/MXParallaxHeader.m @@ -125,6 +125,11 @@ - (void)setProgress:(CGFloat)progress { } } +- (void)loadWithNibName:(NSString *)name bundle:(nullable NSBundle *)bundleOrNil options:(nullable NSDictionary *)optionsOrNil { + UINib *nib = [UINib nibWithNibName:name bundle:bundleOrNil]; + [nib instantiateWithOwner:self options:optionsOrNil]; +} + #pragma mark Constraints - (void)updateConstraints { @@ -249,7 +254,6 @@ - (void)adjustScrollViewTopInset:(CGFloat)top { - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (context == kMXParallaxHeaderKVOContext) { - if ([keyPath isEqualToString:NSStringFromSelector(@selector(contentOffset))]) { [self layoutContentView]; } From 1d481e825b918436104a684e215a8e6e35575f97 Mon Sep 17 00:00:00 2001 From: maxep Date: Fri, 10 May 2019 14:00:38 +0200 Subject: [PATCH 06/19] Remove iOS8 support --- MXParallaxHeader.podspec | 2 +- MXParallaxHeader/MXParallaxHeader.m | 59 +++++++++-------------- MXParallaxHeader/MXScrollViewController.h | 8 +-- MXParallaxHeader/MXScrollViewController.m | 34 ++++++++++++- 4 files changed, 61 insertions(+), 42 deletions(-) diff --git a/MXParallaxHeader.podspec b/MXParallaxHeader.podspec index 505cec6..bb3853f 100644 --- a/MXParallaxHeader.podspec +++ b/MXParallaxHeader.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/maxep/MXParallaxHeader.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/MaximeEpain' - s.platform = :ios, '8.0' + s.platform = :ios, '9.0' s.requires_arc = true s.source_files = 'MXParallaxHeader/*.{m,h}' diff --git a/MXParallaxHeader/MXParallaxHeader.m b/MXParallaxHeader/MXParallaxHeader.m index 1818d34..08135ab 100644 --- a/MXParallaxHeader/MXParallaxHeader.m +++ b/MXParallaxHeader/MXParallaxHeader.m @@ -166,53 +166,42 @@ - (void)updateConstraints { } - (void)setCenterModeConstraints { - - NSDictionary *binding = @{@"v" : self.view}; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:binding]]; - - [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.view - attribute:NSLayoutAttributeCenterY - relatedBy:NSLayoutRelationEqual - toItem:self.contentView - attribute:NSLayoutAttributeCenterY - multiplier:1 - constant:0]]; - - [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.view - attribute:NSLayoutAttributeHeight - relatedBy:NSLayoutRelationEqual - toItem:nil - attribute:NSLayoutAttributeNotAnAttribute - multiplier:1 - constant:self.height]]; + [self.view.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor].active = YES; + [self.view.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor].active = YES; + [self.view.centerYAnchor constraintEqualToAnchor:self.contentView.centerYAnchor].active = YES; + [self.view.heightAnchor constraintEqualToConstant:self.height].active = YES; } - (void)setFillModeConstraints { - NSDictionary *binding = @{@"v" : self.view}; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:binding]]; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[v]|" options:0 metrics:nil views:binding]]; + [self.view.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor].active = YES; + [self.view.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor].active = YES; + [self.view.topAnchor constraintEqualToAnchor:self.contentView.topAnchor].active = YES; + [self.view.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor].active = YES; } - (void)setTopFillModeConstraints { - NSDictionary *binding = @{@"v" : self.view}; - NSDictionary *metrics = @{@"highPriority" : @(UILayoutPriorityDefaultHigh), - @"height" : @(self.height)}; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:binding]]; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[v(>=height)]-0.0@highPriority-|" options:0 metrics:metrics views:binding]]; + [self.view.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor].active = YES; + [self.view.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor].active = YES; + [self.view.topAnchor constraintEqualToAnchor:self.contentView.topAnchor].active = YES; + [self.view.heightAnchor constraintGreaterThanOrEqualToConstant:self.height].active = YES; + + NSLayoutConstraint *constraint = [self.view.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor]; + constraint.priority = UILayoutPriorityDefaultHigh; + constraint.active = YES; } - (void)setTopModeConstraints { - NSDictionary *binding = @{@"v" : self.view}; - NSDictionary *metrics = @{@"height" : @(self.height)}; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:binding]]; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[v(==height)]" options:0 metrics:metrics views:binding]]; + [self.view.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor].active = YES; + [self.view.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor].active = YES; + [self.view.topAnchor constraintEqualToAnchor:self.contentView.topAnchor].active = YES; + [self.view.heightAnchor constraintEqualToConstant:self.height].active = YES; } - (void)setBottomModeConstraints { - NSDictionary *binding = @{@"v" : self.view}; - NSDictionary *metrics = @{@"height" : @(self.height)}; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[v]|" options:0 metrics:nil views:binding]]; - [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[v(==height)]|" options:0 metrics:metrics views:binding]]; + [self.view.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor].active = YES; + [self.view.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor].active = YES; + [self.view.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor].active = YES; + [self.view.heightAnchor constraintEqualToConstant:self.height].active = YES; } #pragma mark Private Methods diff --git a/MXParallaxHeader/MXScrollViewController.h b/MXParallaxHeader/MXScrollViewController.h index 0344c1b..5d74146 100644 --- a/MXParallaxHeader/MXScrollViewController.h +++ b/MXParallaxHeader/MXScrollViewController.h @@ -32,17 +32,17 @@ NS_ASSUME_NONNULL_BEGIN /** The scroll view container. */ -@property (nonatomic,readonly) MXScrollView *scrollView; +@property (nonatomic, readonly) MXScrollView *scrollView; /** The parallax header view controller to be added to the scroll view. */ -@property (nonatomic,strong,nullable) UIViewController *headerViewController; +@property (nonatomic, strong, nullable) UIViewController *headerViewController; /** The child view controller to be added to the scroll view. */ -@property (nonatomic,strong,nullable) UIViewController *childViewController; +@property (nonatomic, strong, nullable) UIViewController *childViewController; @end @@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN /** The parallax header. */ -@property (nonatomic,readonly,nullable) MXParallaxHeader *parallaxHeader; +@property (nonatomic, readonly, nullable) MXParallaxHeader *parallaxHeader; @end diff --git a/MXParallaxHeader/MXScrollViewController.m b/MXParallaxHeader/MXScrollViewController.m index d2e4ae7..3e8150e 100644 --- a/MXParallaxHeader/MXScrollViewController.m +++ b/MXParallaxHeader/MXScrollViewController.m @@ -57,22 +57,52 @@ - (void)viewDidLoad { } } } - @catch(NSException *exception) {} + @catch(NSException *exception) { + NSLog(@"%@", exception); + } +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + + if (@available(iOS 11.0, *)) return; + + if (self.automaticallyAdjustsScrollViewInsets && !self.headerMinimumHeight) { + self.scrollView.parallaxHeader.minimumHeight = self.topLayoutGuide.length; + } } - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; + self.scrollView.contentSize = self.scrollView.frame.size; [self layoutChildViewController]; } - (void)layoutChildViewController { - CGRect frame = self.scrollView.frame; + CGRect frame = self.scrollView.bounds; frame.origin = CGPointZero; frame.size.height -= self.scrollView.parallaxHeader.minimumHeight; + + if (@available(iOS 11.0, *)) { } else { + frame.size.height -= self.bottomLayoutGuide.length; + } + self.childViewController.view.frame = frame; } +- (void)viewSafeAreaInsetsDidChange { + [super viewSafeAreaInsetsDidChange]; + + if (!self.headerMinimumHeight) { + self.scrollView.parallaxHeader.minimumHeight = self.view.safeAreaInsets.top; + } + + UIEdgeInsets safeAreaInsets = UIEdgeInsetsZero; + safeAreaInsets.bottom = self.view.safeAreaInsets.bottom; + self.childViewController.additionalSafeAreaInsets = safeAreaInsets; +} + #pragma mark Properties - (MXScrollView *)scrollView { From 6422efb7a8597dc23708d406e482e92020aee4b0 Mon Sep 17 00:00:00 2001 From: maxep Date: Fri, 10 May 2019 14:00:55 +0200 Subject: [PATCH 07/19] Update Example --- Example-objc/Base.lproj/Main.storyboard | 63 +++-------------- .../MXScrollView/MXScrollViewExample.m | 2 +- Example-objc/UIScrollView/StarshipHeader.xib | 23 +++++-- .../MXWebViewController.m | 13 +--- Example-swift/Base.lproj/Main.storyboard | 69 ++++--------------- Example-swift/MXScrollViewExample.swift | 4 +- Example-swift/MXWebViewController.swift | 19 ++--- Example-swift/StarshipHeader.xib | 23 +++++-- Example-swift/UIScrollViewExample.swift | 2 +- MXParallaxHeader.xcodeproj/project.pbxproj | 20 ++++-- 10 files changed, 82 insertions(+), 156 deletions(-) diff --git a/Example-objc/Base.lproj/Main.storyboard b/Example-objc/Base.lproj/Main.storyboard index 38a3c32..ea88ccf 100755 --- a/Example-objc/Base.lproj/Main.storyboard +++ b/Example-objc/Base.lproj/Main.storyboard @@ -101,13 +101,10 @@ - - -
- +
@@ -171,28 +168,6 @@
- - - - - - - - - - - - - - - - - - - - - - @@ -201,46 +176,28 @@ - + - + - - - - + + + + - - - - - - - - - - - - - - - - - - - + - +
- +
diff --git a/Example-objc/MXScrollView/MXScrollViewExample.m b/Example-objc/MXScrollView/MXScrollViewExample.m index 5935352..0e70c09 100755 --- a/Example-objc/MXScrollView/MXScrollViewExample.m +++ b/Example-objc/MXScrollView/MXScrollViewExample.m @@ -41,7 +41,7 @@ - (void)viewDidLoad { [self.scrollView addSubview:self.table2]; // Parallax Header - self.scrollView.parallaxHeader.view = [NSBundle.mainBundle loadNibNamed:@"StarshipHeader" owner:self options:nil].firstObject; // You can set the parallax header view from a nib. + [self.scrollView.parallaxHeader loadWithNibName:@"StarshipHeader" bundle:nil options:nil]; // You can set the parallax header view from a nib. self.scrollView.parallaxHeader.height = 300; self.scrollView.parallaxHeader.mode = MXParallaxHeaderModeFill; self.scrollView.parallaxHeader.minimumHeight = self.topLayoutGuide.length; diff --git a/Example-objc/UIScrollView/StarshipHeader.xib b/Example-objc/UIScrollView/StarshipHeader.xib index a153b06..46748a2 100755 --- a/Example-objc/UIScrollView/StarshipHeader.xib +++ b/Example-objc/UIScrollView/StarshipHeader.xib @@ -1,20 +1,29 @@ - - + + + + + - - + - + + + + + - + - + + + + diff --git a/Example-objc/UIScrollViewController/MXWebViewController.m b/Example-objc/UIScrollViewController/MXWebViewController.m index 9103b8b..8fd652f 100755 --- a/Example-objc/UIScrollViewController/MXWebViewController.m +++ b/Example-objc/UIScrollViewController/MXWebViewController.m @@ -20,6 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +#import #import "MXWebViewController.h" @interface MXWebViewController () @@ -35,16 +36,4 @@ - (void)viewDidLoad { [self.webView loadRequest:request]; } -- (IBAction)back:(id)sender { - [self.webView goBack]; -} - -- (IBAction)forward:(id)sender { - [self.webView goForward]; -} - -- (IBAction)refresh:(id)sender { - [self.webView reload]; -} - @end diff --git a/Example-swift/Base.lproj/Main.storyboard b/Example-swift/Base.lproj/Main.storyboard index 17911cb..ca202a9 100644 --- a/Example-swift/Base.lproj/Main.storyboard +++ b/Example-swift/Base.lproj/Main.storyboard @@ -101,13 +101,10 @@ - - -
- +
@@ -131,28 +128,6 @@
- - - - - - - - - - - - - - - - - - - - - - @@ -161,46 +136,32 @@ - + - - + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - + - + - + diff --git a/Example-swift/MXScrollViewExample.swift b/Example-swift/MXScrollViewExample.swift index 6f448e1..09c641b 100644 --- a/Example-swift/MXScrollViewExample.swift +++ b/Example-swift/MXScrollViewExample.swift @@ -36,7 +36,7 @@ class MXScrollViewExample: UIViewController, UITableViewDelegate, UITableViewDat // Parallax Header scrollView = MXScrollView() - scrollView.parallaxHeader.view = Bundle.main.loadNibNamed("StarshipHeader", owner: self, options: nil)?.first as? UIView // You can set the parallax header view from a nib. + scrollView.parallaxHeader.load(withNibName: "StarshipHeader", bundle: nil, options: nil) // You can set the parallax header view from a nib. scrollView.parallaxHeader.height = 300 scrollView.parallaxHeader.mode = .fill view.addSubview(scrollView) @@ -55,7 +55,7 @@ class MXScrollViewExample: UIViewController, UITableViewDelegate, UITableViewDat override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - scrollView.parallaxHeader.minimumHeight = topLayoutGuide.length + scrollView.parallaxHeader.minimumHeight = view.safeAreaInsets.top } override func viewDidLayoutSubviews() { diff --git a/Example-swift/MXWebViewController.swift b/Example-swift/MXWebViewController.swift index c7cdbcc..ca93aff 100644 --- a/Example-swift/MXWebViewController.swift +++ b/Example-swift/MXWebViewController.swift @@ -21,28 +21,17 @@ // THE SOFTWARE. import UIKit +import WebKit import MXParallaxHeader class MXWebViewController: UIViewController { - - @IBOutlet weak var webView: UIWebView! + + @IBOutlet weak var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() let request = URLRequest(url: URL(string: "https://dribbble.com/search?q=spaceship")!) - webView.loadRequest(request) - } - - @IBAction func back(_ sender: AnyObject) { - webView.goBack() - } - - @IBAction func forward(_ sender: AnyObject) { - webView.goForward() - } - - @IBAction func refresh(_ sender: AnyObject) { - webView.reload() + webView.load(request) } } diff --git a/Example-swift/StarshipHeader.xib b/Example-swift/StarshipHeader.xib index 7d5f902..13bea1b 100644 --- a/Example-swift/StarshipHeader.xib +++ b/Example-swift/StarshipHeader.xib @@ -1,20 +1,29 @@ - - + + + + + - - + - + + + + + - + - + + + + diff --git a/Example-swift/UIScrollViewExample.swift b/Example-swift/UIScrollViewExample.swift index 49cc4fc..852f1d5 100644 --- a/Example-swift/UIScrollViewExample.swift +++ b/Example-swift/UIScrollViewExample.swift @@ -40,7 +40,7 @@ class UIScrollViewExample: UITableViewController, MXParallaxHeaderDelegate { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - tableView.parallaxHeader.minimumHeight = topLayoutGuide.length + tableView.parallaxHeader.minimumHeight = view.safeAreaInsets.top } // MARK: - Table view data source diff --git a/MXParallaxHeader.xcodeproj/project.pbxproj b/MXParallaxHeader.xcodeproj/project.pbxproj index 6ddb905..b716e59 100644 --- a/MXParallaxHeader.xcodeproj/project.pbxproj +++ b/MXParallaxHeader.xcodeproj/project.pbxproj @@ -35,6 +35,7 @@ 9C01BCE71DA3EBBA0032494C /* UIScrollViewExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C01BCE11DA3EBBA0032494C /* UIScrollViewExample.swift */; }; 9C01BCEA1DA3EBFE0032494C /* MXParallaxHeader.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C01BC6F1DA3E4D40032494C /* MXParallaxHeader.framework */; }; 9C01BCEB1DA3EBFE0032494C /* MXParallaxHeader.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9C01BC6F1DA3E4D40032494C /* MXParallaxHeader.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9C71819522856FFF007F7894 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C71819422856FFF007F7894 /* WebKit.framework */; }; 9C7904261DC23C4900149A7E /* MXFalconViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C7904241DC23C4800149A7E /* MXFalconViewController.h */; }; 9C79042A1DC243C100149A7E /* MXFalconViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C7904251DC23C4900149A7E /* MXFalconViewController.m */; }; 9C79042B1DC243C800149A7E /* MXFalconViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C7904281DC242A800149A7E /* MXFalconViewController.swift */; }; @@ -121,6 +122,7 @@ 9C01BCEF1DA3F0E20032494C /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 9C01BCF01DA3F0E20032494C /* MXParallaxHeader.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = MXParallaxHeader.podspec; sourceTree = ""; }; 9C01BCF11DA3F0E20032494C /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + 9C71819422856FFF007F7894 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 9C7904241DC23C4800149A7E /* MXFalconViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXFalconViewController.h; sourceTree = ""; }; 9C7904251DC23C4900149A7E /* MXFalconViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXFalconViewController.m; sourceTree = ""; }; 9C7904281DC242A800149A7E /* MXFalconViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MXFalconViewController.swift; sourceTree = ""; }; @@ -146,6 +148,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 9C71819522856FFF007F7894 /* WebKit.framework in Frameworks */, 9C01BCEA1DA3EBFE0032494C /* MXParallaxHeader.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -162,6 +165,7 @@ 9C01BC911DA3E6810032494C /* Example-objc */, 9C01BCC91DA3E9A80032494C /* Example-swift */, 9C01BC701DA3E4D40032494C /* Products */, + 9C71819322856FFF007F7894 /* Frameworks */, ); sourceTree = ""; }; @@ -280,6 +284,14 @@ name = Metadata; sourceTree = ""; }; + 9C71819322856FFF007F7894 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 9C71819422856FFF007F7894 /* WebKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -651,7 +663,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Framework/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = Framework/module.modulemap; PRODUCT_BUNDLE_IDENTIFIER = fr.maxep.MXParallaxHeader; @@ -674,7 +686,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Framework/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = Framework/module.modulemap; PRODUCT_BUNDLE_IDENTIFIER = fr.maxep.MXParallaxHeader; @@ -716,7 +728,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = C75GEDTP26; INFOPLIST_FILE = "$(SRCROOT)/Example-swift/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "fr.maxep.MXParallaxHeader-swift"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -732,7 +744,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = C75GEDTP26; INFOPLIST_FILE = "$(SRCROOT)/Example-swift/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "fr.maxep.MXParallaxHeader-swift"; PRODUCT_NAME = "$(TARGET_NAME)"; From b4548f9b7420ffabe1792831eed211fcdbff6341 Mon Sep 17 00:00:00 2001 From: maxep Date: Wed, 15 May 2019 09:28:56 +0200 Subject: [PATCH 08/19] Fix #102 #105 --- MXParallaxHeader/MXParallaxHeader.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MXParallaxHeader/MXParallaxHeader.m b/MXParallaxHeader/MXParallaxHeader.m index 08135ab..1a81296 100644 --- a/MXParallaxHeader/MXParallaxHeader.m +++ b/MXParallaxHeader/MXParallaxHeader.m @@ -72,6 +72,8 @@ - (UIView *)contentView { - (void)setView:(UIView *)view { if (view != _view) { + [_view removeFromSuperview]; + _view = view; [self updateConstraints]; } From c6e1d8edce36bec1f8c8d7e8dcb845c094928b0b Mon Sep 17 00:00:00 2001 From: maxep Date: Tue, 6 Aug 2019 15:28:44 +0200 Subject: [PATCH 09/19] Release 1.0.0 --- Example-objc/MXAppDelegate.h | 2 +- Example-objc/MXAppDelegate.m | 2 +- Example-objc/MXScrollView/MXScrollViewExample.h | 2 +- Example-objc/MXScrollView/MXScrollViewExample.m | 2 +- Example-objc/UIScrollView/UIScrollViewExample.h | 2 +- Example-objc/UIScrollView/UIScrollViewExample.m | 2 +- Example-objc/UIScrollViewController/MXFalconViewController.h | 2 +- Example-objc/UIScrollViewController/MXFalconViewController.m | 2 +- Example-objc/UIScrollViewController/MXWebViewController.h | 2 +- Example-objc/UIScrollViewController/MXWebViewController.m | 2 +- Example-objc/main.m | 2 +- Example-swift/AppDelegate.swift | 2 +- Example-swift/MXFalconViewController.swift | 2 +- Example-swift/MXScrollViewExample.swift | 2 +- Example-swift/MXWebViewController.swift | 2 +- Example-swift/UIScrollViewExample.swift | 2 +- Framework/Info.plist | 2 +- LICENSE | 2 +- MXParallaxHeader.podspec | 2 +- MXParallaxHeader/MXParallaxHeader.h | 2 +- MXParallaxHeader/MXParallaxHeader.m | 2 +- MXParallaxHeader/MXScrollView.h | 2 +- MXParallaxHeader/MXScrollView.m | 2 +- MXParallaxHeader/MXScrollViewController.h | 2 +- MXParallaxHeader/MXScrollViewController.m | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Example-objc/MXAppDelegate.h b/Example-objc/MXAppDelegate.h index a59ebc2..92f302d 100755 --- a/Example-objc/MXAppDelegate.h +++ b/Example-objc/MXAppDelegate.h @@ -1,6 +1,6 @@ // MXAppDelegate.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-objc/MXAppDelegate.m b/Example-objc/MXAppDelegate.m index 4d82ec7..cecc9df 100755 --- a/Example-objc/MXAppDelegate.m +++ b/Example-objc/MXAppDelegate.m @@ -1,6 +1,6 @@ // MXAppDelegate.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-objc/MXScrollView/MXScrollViewExample.h b/Example-objc/MXScrollView/MXScrollViewExample.h index 2333ea6..ebcdbd0 100755 --- a/Example-objc/MXScrollView/MXScrollViewExample.h +++ b/Example-objc/MXScrollView/MXScrollViewExample.h @@ -1,6 +1,6 @@ // MXScrollViewExample.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-objc/MXScrollView/MXScrollViewExample.m b/Example-objc/MXScrollView/MXScrollViewExample.m index 0e70c09..1f67693 100755 --- a/Example-objc/MXScrollView/MXScrollViewExample.m +++ b/Example-objc/MXScrollView/MXScrollViewExample.m @@ -1,6 +1,6 @@ // MXScrollViewExample.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-objc/UIScrollView/UIScrollViewExample.h b/Example-objc/UIScrollView/UIScrollViewExample.h index dab0f78..87eab7b 100755 --- a/Example-objc/UIScrollView/UIScrollViewExample.h +++ b/Example-objc/UIScrollView/UIScrollViewExample.h @@ -1,6 +1,6 @@ // UIScrollViewExample.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-objc/UIScrollView/UIScrollViewExample.m b/Example-objc/UIScrollView/UIScrollViewExample.m index 683706e..c344e67 100755 --- a/Example-objc/UIScrollView/UIScrollViewExample.m +++ b/Example-objc/UIScrollView/UIScrollViewExample.m @@ -1,6 +1,6 @@ // UIScrollViewExample.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-objc/UIScrollViewController/MXFalconViewController.h b/Example-objc/UIScrollViewController/MXFalconViewController.h index 46725eb..760b52c 100644 --- a/Example-objc/UIScrollViewController/MXFalconViewController.h +++ b/Example-objc/UIScrollViewController/MXFalconViewController.h @@ -1,6 +1,6 @@ // MXFalconViewController.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-objc/UIScrollViewController/MXFalconViewController.m b/Example-objc/UIScrollViewController/MXFalconViewController.m index 8aa4b67..a676391 100644 --- a/Example-objc/UIScrollViewController/MXFalconViewController.m +++ b/Example-objc/UIScrollViewController/MXFalconViewController.m @@ -1,6 +1,6 @@ // MXFalconViewController.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-objc/UIScrollViewController/MXWebViewController.h b/Example-objc/UIScrollViewController/MXWebViewController.h index fce5ceb..fbc99b6 100755 --- a/Example-objc/UIScrollViewController/MXWebViewController.h +++ b/Example-objc/UIScrollViewController/MXWebViewController.h @@ -1,6 +1,6 @@ // MXWebViewController.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-objc/UIScrollViewController/MXWebViewController.m b/Example-objc/UIScrollViewController/MXWebViewController.m index 8fd652f..5af7290 100755 --- a/Example-objc/UIScrollViewController/MXWebViewController.m +++ b/Example-objc/UIScrollViewController/MXWebViewController.m @@ -1,6 +1,6 @@ // MXWebViewController.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-objc/main.m b/Example-objc/main.m index be56e97..59d72d7 100755 --- a/Example-objc/main.m +++ b/Example-objc/main.m @@ -3,7 +3,7 @@ // MXParallaxHeader // // Created by Maxime Epain on 10/28/2015. -// Copyright (c) 2017 Maxime Epain. All rights reserved. +// Copyright (c) 2019 Maxime Epain. All rights reserved. // @import UIKit; diff --git a/Example-swift/AppDelegate.swift b/Example-swift/AppDelegate.swift index 1bd1814..2854da4 100644 --- a/Example-swift/AppDelegate.swift +++ b/Example-swift/AppDelegate.swift @@ -1,6 +1,6 @@ // AppDelegate.swift // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-swift/MXFalconViewController.swift b/Example-swift/MXFalconViewController.swift index 3391587..08d7ad8 100644 --- a/Example-swift/MXFalconViewController.swift +++ b/Example-swift/MXFalconViewController.swift @@ -1,6 +1,6 @@ // MXFalconViewController.swift // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-swift/MXScrollViewExample.swift b/Example-swift/MXScrollViewExample.swift index 09c641b..c48da41 100644 --- a/Example-swift/MXScrollViewExample.swift +++ b/Example-swift/MXScrollViewExample.swift @@ -1,6 +1,6 @@ // MXScrollViewExample.swift // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-swift/MXWebViewController.swift b/Example-swift/MXWebViewController.swift index ca93aff..1d3d5fe 100644 --- a/Example-swift/MXWebViewController.swift +++ b/Example-swift/MXWebViewController.swift @@ -1,6 +1,6 @@ // MXChildViewController.swift // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example-swift/UIScrollViewExample.swift b/Example-swift/UIScrollViewExample.swift index 852f1d5..01a7bc0 100644 --- a/Example-swift/UIScrollViewExample.swift +++ b/Example-swift/UIScrollViewExample.swift @@ -1,6 +1,6 @@ // UIScrollViewExample.swift // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Framework/Info.plist b/Framework/Info.plist index b1786cd..20b05ec 100644 --- a/Framework/Info.plist +++ b/Framework/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.6.1 + 1.0.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/LICENSE b/LICENSE index a69fd8b..d2c7723 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017 Maxime Epain +Copyright (c) 2019 Maxime Epain Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MXParallaxHeader.podspec b/MXParallaxHeader.podspec index bb3853f..92ba2f8 100644 --- a/MXParallaxHeader.podspec +++ b/MXParallaxHeader.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "MXParallaxHeader" - s.version = "0.6.1" + s.version = "1.0.0" s.summary = "Simple parallax header for UIScrollView." s.description = <<-DESC MXParallaxHeader is a simple header class for UIScrolView. diff --git a/MXParallaxHeader/MXParallaxHeader.h b/MXParallaxHeader/MXParallaxHeader.h index 03dcad3..5e32c09 100644 --- a/MXParallaxHeader/MXParallaxHeader.h +++ b/MXParallaxHeader/MXParallaxHeader.h @@ -1,6 +1,6 @@ // MXParallaxHeader.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/MXParallaxHeader/MXParallaxHeader.m b/MXParallaxHeader/MXParallaxHeader.m index 1a81296..17f5ad0 100644 --- a/MXParallaxHeader/MXParallaxHeader.m +++ b/MXParallaxHeader/MXParallaxHeader.m @@ -1,6 +1,6 @@ // MXParallaxHeader.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/MXParallaxHeader/MXScrollView.h b/MXParallaxHeader/MXScrollView.h index 32eb4c6..76ca0b5 100644 --- a/MXParallaxHeader/MXScrollView.h +++ b/MXParallaxHeader/MXScrollView.h @@ -1,6 +1,6 @@ // MXScrollView.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/MXParallaxHeader/MXScrollView.m b/MXParallaxHeader/MXScrollView.m index 88bfd03..bfc20f3 100644 --- a/MXParallaxHeader/MXScrollView.m +++ b/MXParallaxHeader/MXScrollView.m @@ -1,6 +1,6 @@ // MXScrollView.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/MXParallaxHeader/MXScrollViewController.h b/MXParallaxHeader/MXScrollViewController.h index 5d74146..36565cc 100644 --- a/MXParallaxHeader/MXScrollViewController.h +++ b/MXParallaxHeader/MXScrollViewController.h @@ -1,6 +1,6 @@ // MXScrollViewController.h // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/MXParallaxHeader/MXScrollViewController.m b/MXParallaxHeader/MXScrollViewController.m index 3e8150e..5142e6f 100644 --- a/MXParallaxHeader/MXScrollViewController.m +++ b/MXParallaxHeader/MXScrollViewController.m @@ -1,6 +1,6 @@ // MXScrollViewController.m // -// Copyright (c) 2017 Maxime Epain +// Copyright (c) 2019 Maxime Epain // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal From 335616c87ba20c5af5f5bc572a761364950d3646 Mon Sep 17 00:00:00 2001 From: maxep Date: Thu, 8 Aug 2019 12:42:45 +0200 Subject: [PATCH 10/19] Add github templates --- .github/ISSUE_TEMPLATE.md | 27 +++++++++++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 28 ++++++++++++++++++++++++++++ .github/stale.yml | 27 +++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/stale.yml diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..a3e71b8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,27 @@ + + +NOTE: ISSUES ARE NOT FOR CODE HELP - Ask for Help at https://stackoverflow.com + +Your issue may already be reported! +Please search on the [issue tracker](../) before creating one. + +#### Issue Description +* When Issue Happens +* Steps To Reproduce + +#### Environment Information +* Lib Version +* OS Version + +#### Your Code + +``` +If relevant, paste all of your challenge code in here +``` + +#### Screenshot \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..0c76a91 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,28 @@ + + +## Description + + +## Motivation and Context + + + +## How Has This Been Tested? + + + + +## Screenshots (if appropriate): + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) + +## Checklist: + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. \ No newline at end of file diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..c6e2f85 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,27 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 60 + +# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 7 + +# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) +onlyLabels: [] + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +exemptLabels: + - bug + - help wanted + - enhancement + - need review + +# Label to use when marking as stale +staleLabel: stale + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. \ No newline at end of file From e0dbcb55158fc8089c7cbe048fefc61ef52dddb5 Mon Sep 17 00:00:00 2001 From: maxep Date: Thu, 14 Nov 2019 12:49:49 +0100 Subject: [PATCH 11/19] Use autolayout only --- Example-objc/Base.lproj/Main.storyboard | 77 +++++++++++-- .../MXScrollView/MXScrollViewExample.m | 73 ++---------- Example-swift/Base.lproj/Main.storyboard | 75 ++++++++++-- Example-swift/MXScrollViewExample.swift | 55 ++------- MXParallaxHeader/MXParallaxHeader.h | 2 +- MXParallaxHeader/MXParallaxHeader.m | 87 ++++++++------ MXParallaxHeader/MXScrollView.m | 4 - MXParallaxHeader/MXScrollViewController.m | 107 +++++++++++------- 8 files changed, 272 insertions(+), 208 deletions(-) diff --git a/Example-objc/Base.lproj/Main.storyboard b/Example-objc/Base.lproj/Main.storyboard index ea88ccf..e3993d5 100755 --- a/Example-objc/Base.lproj/Main.storyboard +++ b/Example-objc/Base.lproj/Main.storyboard @@ -1,11 +1,9 @@ - - - - + + - + @@ -24,11 +22,11 @@ - + - + diff --git a/Example-objc/MXScrollView/MXScrollViewExample.m b/Example-objc/MXScrollView/MXScrollViewExample.m index 1f67693..7d005b2 100755 --- a/Example-objc/MXScrollView/MXScrollViewExample.m +++ b/Example-objc/MXScrollView/MXScrollViewExample.m @@ -26,9 +26,9 @@ #define SPANISH_WHITE [UIColor colorWithRed:0.996 green:0.992 blue:0.941 alpha:1] /*#fefdf0*/ @interface MXScrollViewExample () -@property (nonatomic, strong) MXScrollView *scrollView; -@property (nonatomic, strong) UITableView *table1; -@property (nonatomic, strong) UITableView *table2; +@property (nonatomic, strong) IBOutlet MXScrollView *scrollView; +@property (nonatomic, strong) IBOutlet UITableView *table1; +@property (nonatomic, strong) IBOutlet UITableView *table2; @end @implementation MXScrollViewExample @@ -36,68 +36,17 @@ @implementation MXScrollViewExample - (void)viewDidLoad { [super viewDidLoad]; - [self.view addSubview:self.scrollView]; - [self.scrollView addSubview:self.table1]; - [self.scrollView addSubview:self.table2]; - // Parallax Header [self.scrollView.parallaxHeader loadWithNibName:@"StarshipHeader" bundle:nil options:nil]; // You can set the parallax header view from a nib. self.scrollView.parallaxHeader.height = 300; self.scrollView.parallaxHeader.mode = MXParallaxHeaderModeFill; self.scrollView.parallaxHeader.minimumHeight = self.topLayoutGuide.length; -} -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; - - self.scrollView.parallaxHeader.minimumHeight = self.topLayoutGuide.length; -} + self.table1.backgroundColor = SPANISH_WHITE; + [self.table1 registerClass:UITableViewCell.class forCellReuseIdentifier:@"cell"]; -// In this example I use manual layout for peformances -- (void)viewDidLayoutSubviews { - [super viewDidLayoutSubviews]; - CGRect frame = self.view.bounds; - - //Update scroll view frame and content size - self.scrollView.frame = frame; - self.scrollView.contentSize = frame.size; - - //Update table 1 frame - frame.size.width /= 2; - frame.size.height -= self.scrollView.parallaxHeader.minimumHeight; - self.table1.frame = frame; - - //Update table 2 frame - frame.origin.x = frame.size.width; - self.table2.frame = frame; -} - -#pragma mark Properties - -- (MXScrollView *)scrollView { - if(!_scrollView) { - _scrollView = [[MXScrollView alloc] init]; - _scrollView.delegate = self; - } - return _scrollView; -} - -- (UITableView *)table1 { - if (!_table1) { - _table1 = [[UITableView alloc] init]; - _table1.dataSource = self; - _table1.backgroundColor = SPANISH_WHITE; - } - return _table1; -} - -- (UITableView *)table2 { - if (!_table2) { - _table2 = [[UITableView alloc] init]; - _table2.dataSource = self; - _table2.backgroundColor = SPANISH_WHITE; - } - return _table2; + self.table2.backgroundColor = SPANISH_WHITE; + [self.table2 registerClass:UITableViewCell.class forCellReuseIdentifier:@"cell"]; } #pragma mark @@ -113,12 +62,8 @@ - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSIntege } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; - } + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; cell.textLabel.text = [NSString stringWithFormat:@"Row %ld", (long)indexPath.row]; cell.backgroundColor = SPANISH_WHITE; diff --git a/Example-swift/Base.lproj/Main.storyboard b/Example-swift/Base.lproj/Main.storyboard index ca202a9..7585fd5 100644 --- a/Example-swift/Base.lproj/Main.storyboard +++ b/Example-swift/Base.lproj/Main.storyboard @@ -1,11 +1,9 @@ - - - - + + - + @@ -24,11 +22,11 @@ - +