-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTSAlertView.h
executable file
·81 lines (60 loc) · 2.68 KB
/
TSAlertView.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
//
// TSAlertView.h
//
// Created by Nick Hodapp aka Tom Swift on 1/19/11.
//
#import <UIKit/UIKit.h>
typedef enum
{
TSAlertViewButtonLayoutNormal,
TSAlertViewButtonLayoutStacked
} TSAlertViewButtonLayout;
typedef enum
{
TSAlertViewStyleNormal,
TSAlertViewStyleInput,
} TSAlertViewStyle;
@class TSAlertViewController;
@class TSAlertView;
@protocol TSAlertViewDelegate <NSObject>
@optional
// Called when a button is clicked. The view will be automatically dismissed after this call returns
- (void)alertView:(TSAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
// Called when we cancel a view (eg. the user clicks the Home button). This is not called when the user clicks the cancel button.
// If not defined in the delegate, we simulate a click in the cancel button
- (void)alertViewCancel:(TSAlertView *)alertView;
- (void)willPresentAlertView:(TSAlertView *)alertView; // before animation and showing view
- (void)didPresentAlertView:(TSAlertView *)alertView; // after animation
- (void)alertView:(TSAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex; // before animation and hiding view
- (void)alertView:(TSAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex; // after animation
@end
@interface TSAlertView : UIView
{
UIImage* _backgroundImage;
UILabel* _titleLabel;
UILabel* _messageLabel;
UITextView* _messageTextView;
UIImageView* _messageTextViewMaskImageView;
UITextField* _inputTextField;
NSMutableArray* _buttons;
}
@property(nonatomic, copy) NSString *title;
@property(nonatomic, copy) NSString *message;
@property(nonatomic, unsafe_unretained) id<TSAlertViewDelegate> delegate;
@property(nonatomic) NSInteger cancelButtonIndex;
@property(nonatomic, readonly) NSInteger firstOtherButtonIndex;
@property(nonatomic, readonly) NSInteger numberOfButtons;
@property(nonatomic, readonly, getter=isVisible) BOOL visible;
@property(nonatomic, assign) TSAlertViewButtonLayout buttonLayout;
@property(nonatomic, assign) CGFloat width;
@property(nonatomic, assign) CGFloat maxHeight;
@property(nonatomic, assign) BOOL usesMessageTextView;
@property(nonatomic, strong) UIImage* backgroundImage;
@property(nonatomic, assign) TSAlertViewStyle style;
@property(unsafe_unretained, nonatomic, readonly) UITextField* inputTextField;
- (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...;
- (NSInteger)addButtonWithTitle:(NSString *)title;
- (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;
- (void)show;
@end