forked from fphilipe/PHFComposeBarView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PHFComposeBarView.h
97 lines (67 loc) · 3.99 KB
/
PHFComposeBarView.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
#import <UIKit/UIKit.h>
// Height of the view when text view is empty. Ideally, you should use this in
// -initWithFrame:.
extern CGFloat const PHFComposeBarViewInitialHeight;
// Each notification includes the view as object and a userInfo dictionary
// containing the beginning and ending view frame. Animation key/value pairs are
// only available for the PHFComposeBarViewWillChangeFrameNotification
// notification.
extern NSString *const PHFComposeBarViewDidChangeFrameNotification;
extern NSString *const PHFComposeBarViewWillChangeFrameNotification;
extern NSString *const PHFComposeBarViewAnimationDurationUserInfoKey; // NSNumber of double
extern NSString *const PHFComposeBarViewAnimationCurveUserInfoKey; // NSNumber of NSUInteger (UIViewAnimationCurve)
extern NSString *const PHFComposeBarViewFrameBeginUserInfoKey; // NSValue of CGRect
extern NSString *const PHFComposeBarViewFrameEndUserInfoKey; // NSValue of CGRect
@protocol PHFComposeBarViewDelegate;
@interface PHFComposeBarView : UIView <UITextViewDelegate>
// Default is YES. When YES, the auto resizing top margin will be flexible.
// Whenever the height changes due to text length, the top offset will
// automatically be adjusted such that the view grows upwards while the bottom
// stays fixed. When NO, the top margin is not flexible. This causes the view to
// grow downwards when the height changes due to the text length. Turning this
// off can be useful in some complicated view setups.
@property (assign, nonatomic) BOOL autoAdjustTopOffset;
@property (strong, nonatomic, readonly) UIButton *button;
// Default is a blue matching that from iMessage (RGB: 0, 122, 255).
@property (strong, nonatomic) UIColor *buttonTintColor UI_APPEARANCE_SELECTOR;
// Default is "Send".
@property (strong, nonatomic) NSString *buttonTitle UI_APPEARANCE_SELECTOR;
@property (weak, nonatomic) id <PHFComposeBarViewDelegate> delegate;
// When set to NO, the text view, the utility button, and the main button are
// disabled.
@property (assign, nonatomic, getter=isEnabled) BOOL enabled;
// Default is 0. When not 0, a counter is shown in the format
// count/maxCharCount. It is placed behind the main button but with a fixed top
// margin, thus only visible if there are at least two lines of text.
@property (assign, nonatomic) NSUInteger maxCharCount;
// Default is 200.0.
@property (assign, nonatomic) CGFloat maxHeight;
// Default is 9. Merely a conversion from maxHeight property.
@property (assign, nonatomic) CGFloat maxLinesCount;
// Default is nil. This is a shortcut for the text property of placeholderLabel.
@property (strong, nonatomic) NSString *placeholder UI_APPEARANCE_SELECTOR;
@property (nonatomic, readonly) UILabel *placeholderLabel;
// Default is nil. This is a shortcut for the text property of textView. Setting
// the text can be animated by using the -setText:animated: method.
@property (strong, nonatomic) NSString *text;
@property (strong, nonatomic, readonly) UITextView *textView;
@property (strong, nonatomic, readonly) UIButton *utilityButton;
// Default is nil. Images should be white on transparent background. The side
// length should not exceed 16 points. The button is only visible when an image
// is set. Thus, to hide the button, set this property to nil.
@property (strong, nonatomic) UIImage *utilityButtonImage UI_APPEARANCE_SELECTOR;
- (void)setText:(NSString *)text animated:(BOOL)animated;
@end
@protocol PHFComposeBarViewDelegate <NSObject, UITextViewDelegate>
@optional
- (void)composeBarViewDidPressButton:(PHFComposeBarView *)composeBarView;
- (void)composeBarViewDidPressUtilityButton:(PHFComposeBarView *)composeBarView;
- (void)composeBarView:(PHFComposeBarView *)composeBarView
willChangeFromFrame:(CGRect)startFrame
toFrame:(CGRect)endFrame
duration:(NSTimeInterval)duration
animationCurve:(UIViewAnimationCurve)animationCurve;
- (void)composeBarView:(PHFComposeBarView *)composeBarView
didChangeFromFrame:(CGRect)startFrame
toFrame:(CGRect)endFrame;
@end