Skip to content
This repository has been archived by the owner on Apr 27, 2019. It is now read-only.

Commit

Permalink
Update delegate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Carson Perrotti committed Oct 6, 2014
1 parent 6f24575 commit 19bc860
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
4 changes: 2 additions & 2 deletions CNPPopupController.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "CNPPopupController"
s.version = "0.0.3"
s.version = "0.0.4"
s.summary = "A versatile popup for iOS"

s.description = <<-DESC
Expand Down Expand Up @@ -77,7 +77,7 @@ Pod::Spec.new do |s|
# Supports git, hg, bzr, svn and HTTP.
#

s.source = { :git => "https://github.com/carsonperrotti/CNPPopupController.git", :tag => "0.0.3" }
s.source = { :git => "https://github.com/carsonperrotti/CNPPopupController.git", :tag => "0.0.4" }


# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
Expand Down
3 changes: 3 additions & 0 deletions CNPPopupController/CNPPopupController.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@

@protocol CNPPopupControllerDelegate <NSObject>

@optional
- (void)popupControllerWillPresent:(CNPPopupController *)controller;
- (void)popupControllerDidPresent:(CNPPopupController *)controller;
- (void)popupController:(CNPPopupController *)controller willDismissWithButtonTitle:(NSString *)title;
- (void)popupController:(CNPPopupController *)controller didDismissWithButtonTitle:(NSString *)title;

@end
23 changes: 8 additions & 15 deletions CNPPopupController/CNPPopupController.m
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ - (void)presentPopupControllerAnimated:(BOOL)flag {
[self layoutIfNeeded];
[self setPresentedConstraints];

if ([self.delegate respondsToSelector:@selector(popupControllerWillPresent:)]) {
[self.delegate popupControllerWillPresent:self];
}

[UIView animateWithDuration:flag ? 0.3f : 0.0f
delay:0
options:UIViewAnimationOptionCurveEaseInOut
Expand All @@ -287,6 +291,10 @@ - (void)dismissPopupControllerAnimated:(BOOL)flag withButtonTitle:(NSString *)ti

[self setDismissedConstraints];

if ([self.delegate respondsToSelector:@selector(popupController:willDismissWithButtonTitle:)]) {
[self.delegate popupController:self willDismissWithButtonTitle:title];
}

[UIView animateWithDuration:flag ? 0.3f : 0.0f
delay:0
options:UIViewAnimationOptionCurveEaseInOut
Expand Down Expand Up @@ -354,23 +362,8 @@ - (void)setPresentedConstraints {

#pragma mark - Window Handling

//- (void)layoutSubviews {
// [super layoutSubviews];
// CGFloat maxWidth = self.contentView.bounds.size.width - (self.theme.popupContentInsets.left + self.theme.popupContentInsets.right);
// for (UIView *view in self.contentView.subviews) {
// if ([view isKindOfClass:[UILabel class]]) {
// [((UILabel *)view) setPreferredMaxLayoutWidth:maxWidth];
// }
// }
// [self.contentView setNeedsUpdateConstraints];
//}

- (void)statusBarFrameOrOrientationChanged:(NSNotification *)notification
{
/*
This notification is most likely triggered inside an animation block,
therefore no animation is needed to perform this nice transition.
*/
[self rotateAccordingToStatusBarOrientationAndSupportedOrientations];
}

Expand Down
4 changes: 2 additions & 2 deletions CNPPopupControllerExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.3</string>
<string>0.0.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>136</string>
<string>137</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down

0 comments on commit 19bc860

Please sign in to comment.