diff --git a/Example/RMessage.xcodeproj/project.pbxproj b/Example/RMessage.xcodeproj/project.pbxproj index d109129..5434c96 100644 --- a/Example/RMessage.xcodeproj/project.pbxproj +++ b/Example/RMessage.xcodeproj/project.pbxproj @@ -292,7 +292,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -332,7 +332,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -347,7 +347,6 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; INFOPLIST_FILE = RMessage/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.testdomain.RMessage; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -361,7 +360,6 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; INFOPLIST_FILE = RMessage/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.testdomain.RMessage; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/RMessage.podspec b/RMessage.podspec index a8928c9..7ea0f62 100644 --- a/RMessage.podspec +++ b/RMessage.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "RMessage" - s.version = "2.1.1" + s.version = "2.1.2" s.summary = "Easy to use and customizable messages/notifications for iOS" s.description = <<-DESC This framework provides an easy to use class to show little notification views on the top of the screen. @@ -23,7 +23,7 @@ There are 4 different types already set up for you: Success, Error, Warning, Mes s.source = { :git => "https://github.com/donileo/RMessage.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/donileo' - s.platform = :ios, '9.0' + s.platform = :ios, '7.0' s.requires_arc = true s.source_files = 'RMessage/**/*.{h,m}' diff --git a/RMessage/RMessageView.m b/RMessage/RMessageView.m index d67e2a7..8e2c341 100644 --- a/RMessage/RMessageView.m +++ b/RMessage/RMessageView.m @@ -113,9 +113,9 @@ + (BOOL)isNavigationBarHiddenForNavigationController:(UINavigationController *)n } } -+ (BOOL)runtimeIsIos7OrHigher ++ (BOOL)compilingForHigherThanIosVersion:(CGFloat)version { -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= version * 10000 return YES; #else return NO; @@ -386,8 +386,12 @@ - (void)setupLayout attribute:NSLayoutAttributeCenterX multiplier:1.f constant:0.f]; - centerXConstraint.active = YES; - self.topToVCLayoutConstraint.active = YES; + if ([RMessageView compilingForHigherThanIosVersion:8.f]) { + centerXConstraint.active = YES; + self.topToVCLayoutConstraint.active = YES; + } else { + [self.viewController.view addConstraints:@[centerXConstraint, self.topToVCLayoutConstraint]]; + } } - (void)executeMessageViewCallBack @@ -669,39 +673,22 @@ - (void)animateMessage { [self.superview layoutIfNeeded]; self.alpha = 0.f; - if ([RMessageView runtimeIsIos7OrHigher]) { - [UIView animateWithDuration:kRMessageAnimationDuration + 0.2f - delay:0.f - usingSpringWithDamping:0.7 - initialSpringVelocity:0.f - options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction - animations:^{ - self.alpha = self.messageOpacity; - self.topToVCLayoutConstraint.constant = self.topToVCFinalConstant; - [self.superview layoutIfNeeded]; + [UIView animateWithDuration:kRMessageAnimationDuration + 0.2f + delay:0.f + usingSpringWithDamping:0.7 + initialSpringVelocity:0.f + options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction + animations:^{ + self.alpha = self.messageOpacity; + self.topToVCLayoutConstraint.constant = self.topToVCFinalConstant; + [self.superview layoutIfNeeded]; + } + completion:^(BOOL finished) { + self.messageIsFullyDisplayed = YES; + if ([self.delegate respondsToSelector:@selector(messageViewDidPresent:)]) { + [self.delegate messageViewDidPresent:self]; } - completion:^(BOOL finished) { - self.messageIsFullyDisplayed = YES; - if ([self.delegate respondsToSelector:@selector(messageViewDidPresent:)]) { - [self.delegate messageViewDidPresent:self]; - } - }]; - - } else { - [UIView animateWithDuration:kRMessageAnimationDuration + 0.2f - delay:0.f - options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction - animations:^{ - self.alpha = self.messageOpacity; - self.topToVCLayoutConstraint.constant = self.topToVCFinalConstant; - [self.superview layoutIfNeeded]; - } completion:^(BOOL finished) { - self.messageIsFullyDisplayed = YES; - if ([self.delegate respondsToSelector:@selector(messageViewDidPresent:)]) { - [self.delegate messageViewDidPresent:self]; - } - }]; - } + }]; } - (void)dismiss