中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

UITextView 文本輸入框

2018-07-20    來源:open-open

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用
////別忘在 .h 中寫代理  <UITextViewDelegate>
 
///UILabel 顯示的文本只讀,無法編輯,可以根據(jù)文字個數(shù)自動換行;
///UITextField 可編輯本文,但是無法換行,只能在一行顯示;當點擊鍵盤上的return時會收到一個事件做一些事情。
////UITextView 可編輯文本,提供換行功能。
 
UITextView* textView = [[UITextView alloc] initWithFrame:CGRectMake(10, 10, 300, 100)];
    textView.backgroundColor = [UIColor grayColor];
    //文本
    textView.text = @"aa";
    //字體
    textView.font = [UIFont boldSystemFontOfSize:20.0];
    //對齊
    textView.textAlignment = NSTextAlignmentCenter;
    //字體顏色
    textView.textColor = [UIColor redColor];
    //允許編輯
    textView.editable = YES;
    //用戶交互     /////////////////////若想有滾動條 不能交互 上為No,下為Yes
    textView.userInteractionEnabled = YES; ///
    //自定義鍵盤
    //textView.inputView = view;
    //textView.inputAccessoryView = view;
    textView.delegate = self;
    [self.view addSubview:textView];
    //[textView release];
     
 //////////事件
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    //判斷類型,如果是UITextView類型,收起鍵盤
    for (UIView* view in self.view.subviews) {
        if ([view isKindOfClass:[UITextView class]]) {
            UITextView* tv = (UITextView*)view;
            [tv resignFirstResponder];
        }
    }
}
 
 
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    return YES;
}
- (BOOL)textViewShouldEndEditing:(UITextView *)textView{
    return YES;
}
 
- (void)textViewDidBeginEditing:(UITextView *)textView{
    NSLog(@"開始編輯");
}
- (void)textViewDidEndEditing:(UITextView *)textView{
    NSLog(@"結(jié)束編輯");
}
 
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
 
    return YES;
}
- (void)textViewDidChange:(UITextView *)textView{
    NSLog(@"已經(jīng)修改");
}
 
- (void)textViewDidChangeSelection:(UITextView *)textView{
    NSLog(@"textViewDidChangeSelection");
}

標簽: idc

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:python連接mongodb操作代碼

下一篇:jsp 文件安全下載