<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ~~~ 1.創建并初始化 @property (nonatomic, strong) UITextView *textView; // 創建 self.textView = [[UITextView alloc] initWithFrame:self.view.frame]; // 設置textview里面的字體顏色 self.textView.textColor = [UIColor blackColor]; // 設置字體名字和字體大小 self.textView.font = [UIFont fontWithName:@"Arial" size:18.0]; // 設置代理 self.textView.delegate = self; // 設置它的背景顏色 self.textView.backgroundColor = [UIColor whiteColor]; self.textView.text = @“hehe”; // 返回鍵的類型 self.textView.returnKeyType = UIReturnKeyDefault; // 鍵盤類型 self.textView.keyboardType = UIKeyboardTypeDefault; // 是否可以拖動 self.textView.scrollEnabled = YES; 2. UITextView退出鍵盤的幾種方式 (1)如果你程序是有導航條的,可以在導航條上面加多一個Done的按鈕,用來退出鍵盤,當然要先實現UITextViewDelegate。 - (void)textViewDidBeginEditing:(UITextView *)textView { self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(getOverEditing)]; } - (void)textViewDidEndEditing:(UITextView *)textView { self.navigationItem.rightBarButtonItem = nil; } - (void)getOverEditing{ [self.textView resignFirstResponder]; } (2)如果你的textview里不用回車鍵,可以把回車鍵當做退出鍵盤的響應鍵。 #pragma mark - UITextView Delegate Methods -(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { if ([text isEqualToString:@"\n"]) { [textView resignFirstResponder]; return NO; } return YES; } (3)還有你也可以自定義其他視圖控件加載到鍵盤上用來退出,比如在彈出的鍵盤上面加一個view來放置退出鍵盤的Done按鈕。 UIToolbar * topView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 30)]; UIBarButtonItem * cancelButton= [[UIBarButtonItem alloc]initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(dismissKeyBoard)]; NSArray * buttonsArray = @[cancelButton]; [topView setItems:buttonsArray]; [self.textView setInputAccessoryView:topView]; -(void)dismissKeyBoard { [tvTextView resignFirstResponder]; } 3.UITextView自定選擇文字后的菜單 在ViewDidLoad中加入: - (void)viewDidLoad { [super viewDidLoad]; self._textView = [[UITextView alloc] initWithFrame:CGRectMake(10, 100, 300, 200)]; [self.view addSubview:_textView]; UIMenuItem *menuItem = [[UIMenuItem alloc]initWithTitle:@“我是自定義的菜單" action:@selector(didClickCustomMenuAction)]; UIMenuController *menu = [UIMenuController sharedMenuController]; [menu setMenuItems:[NSArray arrayWithObject:menuItem]]; [menuItem release]; } 當然上面那個@selector里面的changeColor方法還是自己寫吧,也就是說點擊了我們自定義的菜單項后會觸發的方法。 然后還得在代碼里加上一個方法: -(BOOL)canPerformAction:(SEL)action withSender:(id)sender { if(action ==@selector(changeColor) || action == @selector(copy:)) { if(_textView.selectedRange.length>0) return YES; } return NO; } -(void)didClickCustomMenuAction { NSLog(@"%@“,__function__); } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看