-
Notifications
You must be signed in to change notification settings - Fork 95
/
PXAlertView.h
102 lines (82 loc) · 3.8 KB
/
PXAlertView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//
// PXAlertView.h
// PXAlertViewDemo
//
// Created by Alex Jarvis on 25/09/2013.
// Copyright (c) 2013 Panaxiom Ltd. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void(^PXAlertViewCompletionBlock)(BOOL cancelled, NSInteger buttonIndex);
@interface PXAlertView : UIViewController
@property (nonatomic, getter = isVisible) BOOL visible;
+ (instancetype)showAlertWithTitle:(NSString *)title;
+ (instancetype)showAlertWithTitle:(NSString *)title
message:(NSString *)message;
+ (instancetype)showAlertWithTitle:(NSString *)title
message:(NSString *)message
completion:(PXAlertViewCompletionBlock)completion;
+ (instancetype)showAlertWithTitle:(NSString *)title
message:(NSString *)message
cancelTitle:(NSString *)cancelTitle
completion:(PXAlertViewCompletionBlock)completion;
+ (instancetype)showAlertWithTitle:(NSString *)title
message:(NSString *)message
cancelTitle:(NSString *)cancelTitle
otherTitle:(NSString *)otherTitle
completion:(PXAlertViewCompletionBlock)completion;
+ (instancetype)showAlertWithTitle:(NSString *)title
message:(NSString *)message
cancelTitle:(NSString *)cancelTitle
otherTitle:(NSString *)otherTitle
buttonsShouldStack:(BOOL)shouldStack
completion:(PXAlertViewCompletionBlock)completion;
/**
* @param otherTitles Must be a NSArray containing type NSString, or set to nil for no otherTitles.
*/
+ (instancetype)showAlertWithTitle:(NSString *)title
message:(NSString *)message
cancelTitle:(NSString *)cancelTitle
otherTitles:(NSArray *)otherTitles
completion:(PXAlertViewCompletionBlock)completion;
+ (instancetype)showAlertWithTitle:(NSString *)title
message:(NSString *)message
cancelTitle:(NSString *)cancelTitle
otherTitle:(NSString *)otherTitle
contentView:(UIView *)view
completion:(PXAlertViewCompletionBlock)completion;
+ (instancetype)showAlertWithTitle:(NSString *)title
message:(NSString *)message
cancelTitle:(NSString *)cancelTitle
otherTitle:(NSString *)otherTitle
buttonsShouldStack:(BOOL)shouldStack
contentView:(UIView *)view
completion:(PXAlertViewCompletionBlock)completion;
/**
* @param otherTitles Must be a NSArray containing type NSString, or set to nil for no otherTitles.
*/
+ (instancetype)showAlertWithTitle:(NSString *)title
message:(NSString *)message
cancelTitle:(NSString *)cancelTitle
otherTitles:(NSArray *)otherTitles
contentView:(UIView *)view
completion:(PXAlertViewCompletionBlock)completion;
/**
* Adds a button to the receiver with the given title.
* @param title The title of the new button
* @return The index of the new button. Button indices start at 0 and increase in the order they are added.
*/
- (NSInteger)addButtonWithTitle:(NSString *)title;
/**
* Dismisses the receiver
*/
- (void)dismiss;
/**
* Dismisses the receiver, optionally with animation.
*/
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;
/**
* By default the alert allows you to tap anywhere around the alert to dismiss it.
* This method enables or disables this feature.
*/
- (void)setTapToDismissEnabled:(BOOL)enabled;
@end