UNICORN - iOS
MTextView.h
1 //
2 // MTextView.h
3 //
4 // Created by saimushi on 2015/01/04.
5 // Version:1.0
6 //
59 #import <QuartzCore/QuartzCore.h>
60 
61 #define TEXTAREA_BASE_HEIGHT 44
62 #define TEXTAREA_BACKGROUND_COLOR [UIColor whiteColor]
63 #define TEXTVIEW_BG_COLOR [UIColor clearColor]
64 //#define TEXTVIEW_FONT_SIZE 12
65 #define TEXTVIEW_FONT_SIZE 14
66 //#define TEXTVIEW_FONT_COLOR [UIColor grayColor]
67 #define PLACEHOLDER_FONT_COLOR [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.1f]
68 #define TEXTVIEW_FONT_COLOR [UIColor colorWithRed:0.4f green:0.4f blue:0.4f alpha:1.0f]
69 
70 @interface MTextView : UIView <UITextViewDelegate, NSLayoutManagerDelegate>
71 {
72  UIView *textAreaView;
73  UIView *childeView;
74  UITextView *textView;
75 }
76 
77 @property (strong, nonatomic) UIView *textAreaView;
78 @property (strong, nonatomic) UIView *childeView;
79 @property (strong, nonatomic) UITextView *textView;
80 
81 /* 左右のボタン及び、テキストViewを指定して初期化 */
82 -(id)initWithFrame:(CGRect)argFrame andIdentifier:(NSString *)argIdentifier
83  andView:(UIView *)argChildeView
84  andMaxInputLength:(int)argMaxInputLength
85  andTextAreaHieght:(float)argTextAreaHeight
86  andPlaceHolder:(NSString *)argPlaceHolder
87 andTextAreaBackgroundImage:(UIImage *)argTextAreaBackgroundImage
88  andTextView:(UITextView *)argTextView
89  andLeftBtn:(UIButton *)argLeftBtn
90  andRightBtn:(UIButton *)argRightBtn
91  leftBlock:(BOOL(^)(NSString *inputText))argLeftCompletion
92  rightBlock:(BOOL(^)(NSString *inputText))argRightCompletion
93  limitCheckBlock:(BOOL(^)(BOOL limitUnover, float length))arglimitCheckCompletion;
94 
95 -(id)initWithFrame:(CGRect)argFrame andIdentifier:(NSString *)argIdentifier
96  andView:(UIView *)argChildeView
97  andMaxInputLength:(int)argMaxInputLength
98  andTextAreaHieght:(float)argTextAreaHeight
99  andPlaceHolder:(NSString *)argPlaceHolder
100 andTextAreaBackgroundImage:(UIImage *)argTextAreaBackgroundImage
101  andLeftBtn:(UIButton *)argLeftBtn
102  andRightBtn:(UIButton *)argRightBtn
103  leftBlock:(BOOL(^)(NSString *inputText))argLeftCompletion
104  rightBlock:(BOOL(^)(NSString *inputText))argRightCompletion
105  limitCheckBlock:(BOOL(^)(BOOL limitUnover, float length))argLimitCheckCompletion;
106 
107 /* 左右のボタン画像及び、テキストView背景画像を指定して初期化 */
108 -(id)initWithFrame:(CGRect)argFrame andIdentifier:(NSString *)argIdentifier
109  andView:(UIView *)argChildeView
110  andMaxInputLength:(int)argMaxInputLength
111  andTextAreaHieght:(float)argTextAreaHeight
112  andPlaceHolder:(NSString *)argPlaceHolder
113 andTextAreaBackgroundImage:(UIImage *)argTextAreaBackgroundImage
114  andLeftBtnImage:(UIImage *)argLeftBtnImage
115  andRightImage:(UIImage *)argRightBtnImage
116  leftBlock:(BOOL(^)(NSString *inputText))argLeftCompletion
117  rightBlock:(BOOL(^)(NSString *inputText))argRightCompletion
118  limitCheckBlock:(BOOL(^)(BOOL limitUnover, float length))arglimitCheckCompletion;
119 
120 /* 固定のUIで初期化 */
121 -(id)initWithFrame:(CGRect)argFrame andIdentifier:(NSString *)argIdentifier
122  andView:(UIView *)argChildeView
123  andMaxInputLength:(int)argMaxInputLength
124  andPlaceHolder:(NSString *)argPlaceHolder
125  leftBlock:(BOOL(^)(NSString *inputText))argLeftCompletion
126  rightBlock:(BOOL(^)(NSString *inputText))argRightCompletion
127  limitCheckBlock:(BOOL(^)(BOOL limitUnover, float length))arglimitCheckCompletion;
128 
129 /* キーボードを外から閉じる */
130 - (void)hideKeyboard;
131 /* 入力テキストを外からクリアする */
132 - (void)clearText;
133 /* 入力テキストを外からセットする */
134 - (void)setText:(NSString *)argText;
135 /* 外から+ボタンのEnable・Disableを操作するアクセサ */
136 - (void)enabledLeft:(BOOL)argEnabled;
137 /* 外から入力テキストを取得する */
138 - (NSString *)getText;
139 /* 外から送信ボタンのEnable・Disableを操作するアクセサ */
140 - (void)enabledRight:(BOOL)argEnabled;
141 /* キーボード表示アニメーション */
142 - (void)keyboardWillShow:(NSNotification *)notification;
143 /* キーボード非表示アニメーション */
144 - (void)keyboardWillHide:(NSNotification *)notification;
145 
146 @end
Definition: MTextView.h:70