forked from alexanderjarvis/PXAlertView
/
PXAlertView.h
124 lines (97 loc) · 4.53 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//
// PXAlertView.h
// PXAlertViewDemo
//
// Created by Alex Jarvis on 25/09/2013.
// Copyright (c) 2013 Panaxiom Ltd. All rights reserved.
//
#import <UIKit/UIKit.h>
@class PXAlertView;
typedef void(^PXAlertViewCompletionBlock)(BOOL cancelled, NSInteger buttonIndex, PXAlertView *alert);
@protocol PXAlertViewDelegate <NSObject>
- (void)alertViewDidSelectLinkWithURL:(NSURL *)url;
@end
@interface PXAlertView : UIViewController
@property (nonatomic, getter = isVisible) BOOL visible;
@property (nonatomic) UIView *contentView;
@property (nonatomic, weak) id<PXAlertViewDelegate> delegate;
+ (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
buttonsShouldStack:(BOOL)shouldStack
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
buttonsShouldStack:(BOOL)shouldStack
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, 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;
- (id)initWithTitle:(NSString *)title
message:(NSString *)message
cancelTitle:(NSString *)cancelTitle
otherTitles:(NSArray *)otherTitles
buttonsShouldStack:(BOOL)shouldstack
contentView:(UIView *)contentView
completion:(PXAlertViewCompletionBlock)completion;
- (void)addLinkToStringInMessage:(NSString *)string URL:(NSURL *)URL;
- (void)show;
- (void)dismiss;
- (void)fixTTTAttributedLabelFormat;
@end