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

Commit 19bc860

Browse files
author
Carson Perrotti
committed
Update delegate methods
1 parent 6f24575 commit 19bc860

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

CNPPopupController.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "CNPPopupController"
19-
s.version = "0.0.3"
19+
s.version = "0.0.4"
2020
s.summary = "A versatile popup for iOS"
2121

2222
s.description = <<-DESC
@@ -77,7 +77,7 @@ Pod::Spec.new do |s|
7777
# Supports git, hg, bzr, svn and HTTP.
7878
#
7979

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

8282

8383
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

CNPPopupController/CNPPopupController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434

3535
@protocol CNPPopupControllerDelegate <NSObject>
3636

37+
@optional
38+
- (void)popupControllerWillPresent:(CNPPopupController *)controller;
3739
- (void)popupControllerDidPresent:(CNPPopupController *)controller;
40+
- (void)popupController:(CNPPopupController *)controller willDismissWithButtonTitle:(NSString *)title;
3841
- (void)popupController:(CNPPopupController *)controller didDismissWithButtonTitle:(NSString *)title;
3942

4043
@end

CNPPopupController/CNPPopupController.m

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ - (void)presentPopupControllerAnimated:(BOOL)flag {
263263
[self layoutIfNeeded];
264264
[self setPresentedConstraints];
265265

266+
if ([self.delegate respondsToSelector:@selector(popupControllerWillPresent:)]) {
267+
[self.delegate popupControllerWillPresent:self];
268+
}
269+
266270
[UIView animateWithDuration:flag ? 0.3f : 0.0f
267271
delay:0
268272
options:UIViewAnimationOptionCurveEaseInOut
@@ -287,6 +291,10 @@ - (void)dismissPopupControllerAnimated:(BOOL)flag withButtonTitle:(NSString *)ti
287291

288292
[self setDismissedConstraints];
289293

294+
if ([self.delegate respondsToSelector:@selector(popupController:willDismissWithButtonTitle:)]) {
295+
[self.delegate popupController:self willDismissWithButtonTitle:title];
296+
}
297+
290298
[UIView animateWithDuration:flag ? 0.3f : 0.0f
291299
delay:0
292300
options:UIViewAnimationOptionCurveEaseInOut
@@ -354,23 +362,8 @@ - (void)setPresentedConstraints {
354362

355363
#pragma mark - Window Handling
356364

357-
//- (void)layoutSubviews {
358-
// [super layoutSubviews];
359-
// CGFloat maxWidth = self.contentView.bounds.size.width - (self.theme.popupContentInsets.left + self.theme.popupContentInsets.right);
360-
// for (UIView *view in self.contentView.subviews) {
361-
// if ([view isKindOfClass:[UILabel class]]) {
362-
// [((UILabel *)view) setPreferredMaxLayoutWidth:maxWidth];
363-
// }
364-
// }
365-
// [self.contentView setNeedsUpdateConstraints];
366-
//}
367-
368365
- (void)statusBarFrameOrOrientationChanged:(NSNotification *)notification
369366
{
370-
/*
371-
This notification is most likely triggered inside an animation block,
372-
therefore no animation is needed to perform this nice transition.
373-
*/
374367
[self rotateAccordingToStatusBarOrientationAndSupportedOrientations];
375368
}
376369

CNPPopupControllerExample/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.0.3</string>
18+
<string>0.0.4</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>136</string>
22+
<string>137</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>UILaunchStoryboardName</key>

0 commit comments

Comments
 (0)