diff --git a/CWPopup.podspec b/CWPopup.podspec index 4532d25..0f24ecb 100644 --- a/CWPopup.podspec +++ b/CWPopup.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CWPopup" - s.version = "1.2.0" + s.version = "1.2.1" s.summary = "A category on UIViewController to present a popup view controller." s.description = "CWPopup adds a category on UIViewController to present a popup view controller. It offers an animated and non-animated presentation of the popup, similarly to presenting a modal controller or pushing a view controller." s.homepage = "http://github.com/cezarywojcik/CWPopup" diff --git a/CWPopup/UIViewController+CWPopup.m b/CWPopup/UIViewController+CWPopup.m index f316951..96200d3 100644 --- a/CWPopup/UIViewController+CWPopup.m +++ b/CWPopup/UIViewController+CWPopup.m @@ -16,6 +16,7 @@ @interface UIImage (ImageBlur) - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage; @end +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 @implementation UIImage (ImageBlur) // This method is taken from Apple's UIImageEffects category provided in WWDC 2013 sample code - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage @@ -148,6 +149,7 @@ - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintCo return outputImage; } @end +#endif #define ANIMATION_TIME 0.5f #define STATUS_BAR_SIZE 22 @@ -357,7 +359,12 @@ - (UIViewController *)popupViewController { } - (void)setUseBlurForPopup:(BOOL)useBlurForPopup { - objc_setAssociatedObject(self, &CWUseBlurForPopup, [NSNumber numberWithBool:useBlurForPopup], OBJC_ASSOCIATION_RETAIN_NONATOMIC); + if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0 && useBlurForPopup) { + NSLog(@"ERROR: Blur unavailable prior to iOS 7"); + objc_setAssociatedObject(self, &CWUseBlurForPopup, [NSNumber numberWithBool:NO], OBJC_ASSOCIATION_RETAIN_NONATOMIC); + } else { + objc_setAssociatedObject(self, &CWUseBlurForPopup, [NSNumber numberWithBool:useBlurForPopup], OBJC_ASSOCIATION_RETAIN_NONATOMIC); + } } - (BOOL)useBlurForPopup { diff --git a/README.md b/README.md index 56e86da..71a2a3a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ CWPopup is a category on UIViewController that allows you to easily make popup v ### [CocoaPods](http://www.cocoapods.org) -`pod 'CWPopup', '~> 1.2.0'` +`pod 'CWPopup', '~> 1.2.1'` ### Manual @@ -22,7 +22,7 @@ Import the directory `CWPopup` into your project. It contains the UIViewControll ### Requirements -* Uses ARC +* ARC * iOS 4.3 ## Usage @@ -34,6 +34,8 @@ You can choose to use either a fade background or a blurred background. The fade self.useBlurForPopup = YES; +**NOTE:** Blur is only available in iOS 7+. + To present a view controller: SamplePopupViewController *samplePopupViewController = [[SamplePopupViewController alloc] initWithNibName:@"SamplePopupViewController" bundle:nil];