Skip to content

Commit

Permalink
1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cezarywojcik committed Sep 15, 2013
1 parent 9eea3ee commit 0d3549b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CWPopup.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CWPopup"
s.version = "1.1.0"
s.version = "1.1.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"
Expand Down
7 changes: 6 additions & 1 deletion CWPopup/UIViewController+CWPopup.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ - (void)presentPopupViewController:(UIViewController *)viewControllerToPresent a
self.popupViewController = viewControllerToPresent;
self.popupViewController.view.autoresizesSubviews = NO;
self.popupViewController.view.autoresizingMask = UIViewAutoresizingNone;
[self.popupViewController viewWillAppear:YES];
CGRect finalFrame = [self getPopupFrameForViewController:viewControllerToPresent];
// parallax setup if iOS7+
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
Expand Down Expand Up @@ -149,9 +150,11 @@ - (void)presentPopupViewController:(UIViewController *)viewControllerToPresent a
viewControllerToPresent.view.frame = finalFrame;
blurView.alpha = self.useBlurForPopup ? 1.0f : 0.4f;
} completion:^(BOOL finished) {
[self.popupViewController viewDidAppear:YES];
[completion invoke];
}];
} else { // don't animate
[self.popupViewController viewDidAppear:YES];
viewControllerToPresent.view.frame = finalFrame;
[self.view addSubview:viewControllerToPresent.view];
[completion invoke];
Expand All @@ -163,6 +166,7 @@ - (void)presentPopupViewController:(UIViewController *)viewControllerToPresent a

- (void)dismissPopupViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion {
UIView *blurView = objc_getAssociatedObject(self, &CWBlurViewKey);
[self.popupViewController viewWillDisappear:YES];
if (flag) { // animate
CGRect initialFrame = self.popupViewController.view.frame;
[UIView animateWithDuration:ANIMATION_TIME delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
Expand All @@ -171,17 +175,18 @@ - (void)dismissPopupViewControllerAnimated:(BOOL)flag completion:(void (^)(void)
// self.popupViewController.view.transform = CGAffineTransformMakeRotation(M_PI/6);
blurView.alpha = 0.0f;
} completion:^(BOOL finished) {
[self.popupViewController viewDidDisappear:YES];
[self.popupViewController.view removeFromSuperview];
[blurView removeFromSuperview];
self.popupViewController = nil;
[completion invoke];
}];
} else { // don't animate
[self.popupViewController viewDidDisappear:YES];
[self.popupViewController.view removeFromSuperview];
[blurView removeFromSuperview];
self.popupViewController = nil;
blurView = nil;

[completion invoke];
}
// remove observer
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CWPopup is a category on UIViewController that allows you to easily make popup v

### [CocoaPods](http://www.cocoapods.org)

`pod 'CWPopup', '~> 1.1.0'`
`pod 'CWPopup', '~> 1.1.1'`

### Manual

Expand All @@ -25,7 +25,7 @@ First of all, import the category.
#import "UIViewController+CWPopup.h"

You can choose to use either a fade background or a blurred background. The fade background will partially fade out the background, whereas the blurred background will apply a blur to the background. **Note:** No background animations will show if you use the blurred background as it is a static image placed on top of the view. The default setting is to use the fade background. To enable the blurred background, in your `viewDidLoad` function, add the following line of code:

self.useBlurForPopup = YES;

To present a view controller:
Expand All @@ -46,19 +46,19 @@ That's all there is to it.
## License

The MIT License (MIT)

Copyright (c) 2013 Cezary Wojcik <http://www.cezarywojcik.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
Binary file added popupblur.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0d3549b

Please sign in to comment.