全部產品
Search
文件中心

Mobile Platform as a Service:段落輸入框

更新時間:Jul 13, 2024

AUParagraphInputBox 為段落輸入框控制項,支援在業務中設定最大字數限制。

效果圖

介面說明

// 段落輸入框

@interface AUParagraphInputBox : UIView

@property (nonatomic, strong) UITextView *textView;      // 輸入框
@property (nonatomic, assign) NSInteger maxInputLen;     // 設定最大輸入字數(需要才設定)

// 初始化
- (instancetype)initWithFrame:(CGRect)frame placeHolder:(NSString *)placeHolder;

// 設定 placeHolder 文本
- (void)setPlaceHolder:(NSString *)placeHolder;

@end

程式碼範例

_paragraphInputBox = [[AUParagraphInputBox alloc] init];
_paragraphInputBox.frame = CGRectMake(0, startY, AUCommonUIGetScreenWidth(), 10);
_paragraphInputBox.maxInputLen = 1240;
_paragraphInputBox.textView.delegate = self;
[_paragraphInputBox setPlaceHolder:@"請輸入你想表達的內容"];
[self.view addSubview:_paragraphInputBox];