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

Commit b568c73

Browse files
author
Carson Perrotti
committed
Version 0.2.0
1 parent 072114c commit b568c73

File tree

6 files changed

+357
-511
lines changed

6 files changed

+357
-511
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.1.2"
19+
s.version = "0.2.0"
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.1.2" }
80+
s.source = { :git => "https://github.com/carsonperrotti/CNPPopupController.git", :tag => "0.2.0" }
8181

8282

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

CNPPopupController/CNPPopupController.h

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,14 @@
99
#import <UIKit/UIKit.h>
1010

1111
@protocol CNPPopupControllerDelegate;
12-
@class CNPPopupTheme, CNPPopupButtonItem;
12+
@class CNPPopupTheme, CNPPopupButton;
1313

1414
@interface CNPPopupController : NSObject
1515

16-
@property (nonatomic, strong) NSAttributedString *popupTitle;
17-
@property (nonatomic, strong) NSArray *contents;
18-
@property (nonatomic, strong) NSArray *buttonItems;
19-
@property (nonatomic, strong) CNPPopupButtonItem *destructiveButtonItem;
2016
@property (nonatomic, strong) CNPPopupTheme *theme;
21-
2217
@property (nonatomic, weak) id <CNPPopupControllerDelegate> delegate;
2318

24-
- (instancetype)initWithTitle:(NSAttributedString *)popupTitle
25-
contents:(NSArray *)contents
26-
buttonItems:(NSArray *)buttonItems
27-
destructiveButtonItem:(CNPPopupButtonItem *)destructiveButtonItem;
19+
- (instancetype)initWithContents:(NSArray *)contents;
2820

2921
- (void)presentPopupControllerAnimated:(BOOL)flag;
3022
- (void)dismissPopupControllerAnimated:(BOOL)flag;
@@ -36,8 +28,16 @@
3628
@optional
3729
- (void)popupControllerWillPresent:(CNPPopupController *)controller;
3830
- (void)popupControllerDidPresent:(CNPPopupController *)controller;
39-
- (void)popupController:(CNPPopupController *)controller willDismissWithButtonTitle:(NSString *)title;
40-
- (void)popupController:(CNPPopupController *)controller didDismissWithButtonTitle:(NSString *)title;
31+
- (void)popupControllerWillDismiss:(CNPPopupController *)controller;
32+
- (void)popupControllerDidDismiss:(CNPPopupController *)controller;
33+
34+
@end
35+
36+
typedef void(^SelectionHandler) (CNPPopupButton *button);
37+
38+
@interface CNPPopupButton : UIButton
39+
40+
@property (nonatomic, strong) SelectionHandler selectionHandler;
4141

4242
@end
4343

@@ -59,38 +59,23 @@ typedef NS_ENUM(NSInteger, CNPPopupPresentationStyle) {
5959

6060
// CNPPopupMaskType
6161
typedef NS_ENUM(NSInteger, CNPPopupMaskType) {
62-
CNPPopupMaskTypeNone = 0, // Allow interaction with underlying views.
63-
CNPPopupMaskTypeClear, // Don't allow interaction with underlying views.
64-
CNPPopupMaskTypeDimmed, // Don't allow interaction with underlying views, dim background.
62+
CNPPopupMaskTypeClear,
63+
CNPPopupMaskTypeDimmed
6564
};
6665

67-
typedef void(^SelectionHandler) (CNPPopupButtonItem *item);
68-
69-
@interface CNPPopupButtonItem : NSObject
70-
71-
@property (nonatomic, strong) NSAttributedString *buttonTitle;
72-
@property (nonatomic, strong) UIColor *backgroundColor;
73-
@property (nonatomic, strong) UIColor *borderColor;
74-
@property (nonatomic, assign) CGFloat borderWidth;
75-
@property (nonatomic, assign) CGFloat cornerRadius;
76-
@property (nonatomic, assign) CGFloat buttonHeight;
77-
@property (nonatomic, strong) SelectionHandler selectionHandler;
78-
79-
+ (CNPPopupButtonItem *)defaultButtonItemWithTitle:(NSAttributedString *)title backgroundColor:(UIColor *)color;
80-
81-
@end
82-
8366
@interface CNPPopupTheme : NSObject
8467

8568
@property (nonatomic, strong) UIColor *backgroundColor; // Background color of the popup content view (Default white)
86-
@property (nonatomic, assign) CGFloat cornerRadius; // Corner radius of the popup content view (Default 6.0)
69+
@property (nonatomic, assign) CGFloat cornerRadius; // Corner radius of the popup content view (Default 4.0)
8770
@property (nonatomic, assign) UIEdgeInsets popupContentInsets; // Inset of labels, images and buttons on the popup content view (Default 16.0 on all sides)
8871
@property (nonatomic, assign) CNPPopupStyle popupStyle; // How the popup looks once presented (Default centered)
89-
@property (nonatomic, assign) CNPPopupPresentationStyle presentationStyle; // How the popup is presented (Defauly slide in from bottom)
90-
@property (nonatomic, assign) BOOL dismissesOppositeDirection; // If presented from a direction, should it dismiss in the opposite? (Defaults to NO. i.e. Goes back the way it came in)
72+
@property (nonatomic, assign) CNPPopupPresentationStyle presentationStyle; // How the popup is presented (Defauly slide in from bottom. NOTE: Only applicable to CNPPopupStyleCentered)
9173
@property (nonatomic, assign) CNPPopupMaskType maskType; // Backgound mask of the popup (Default dimmed)
74+
@property (nonatomic, assign) BOOL dismissesOppositeDirection; // If presented from a direction, should it dismiss in the opposite? (Defaults to NO. i.e. Goes back the way it came in)
9275
@property (nonatomic, assign) BOOL shouldDismissOnBackgroundTouch; // Popup should dismiss on tapping on background mask (Default yes)
76+
@property (nonatomic, assign) BOOL movesAboveKeyboard; // Popup should move up when the keyboard appears (Default yes)
9377
@property (nonatomic, assign) CGFloat contentVerticalPadding; // Spacing between each vertical element (Default 12.0)
78+
@property (nonatomic, assign) CGFloat maxPopupWidth; // Maxiumum width that the popup should be (Default 300)
9479

9580
// Factory method to help build a default theme
9681
+ (CNPPopupTheme *)defaultTheme;

0 commit comments

Comments
 (0)