• <small id='Ra5RL'></small><noframes id='Ra5RL'>

    <tfoot id='Ra5RL'></tfoot>

      <bdo id='Ra5RL'></bdo><ul id='Ra5RL'></ul>
  • <legend id='Ra5RL'><style id='Ra5RL'><dir id='Ra5RL'><q id='Ra5RL'></q></dir></style></legend>

      1. <i id='Ra5RL'><tr id='Ra5RL'><dt id='Ra5RL'><q id='Ra5RL'><span id='Ra5RL'><b id='Ra5RL'><form id='Ra5RL'><ins id='Ra5RL'></ins><ul id='Ra5RL'></ul><sub id='Ra5RL'></sub></form><legend id='Ra5RL'></legend><bdo id='Ra5RL'><pre id='Ra5RL'><center id='Ra5RL'></center></pre></bdo></b><th id='Ra5RL'></th></span></q></dt></tr></i><div id='Ra5RL'><tfoot id='Ra5RL'></tfoot><dl id='Ra5RL'><fieldset id='Ra5RL'></fieldset></dl></div>

        如何在 UItextView 中添加 placeHolder 文本?在 iphone sdk 中

        How to add placeHolder Text in UItextView? in iphone sdk(如何在 UItextView 中添加 placeHolder 文本?在 iphone sdk 中)
              <bdo id='li4bR'></bdo><ul id='li4bR'></ul>

                <tbody id='li4bR'></tbody>
              <legend id='li4bR'><style id='li4bR'><dir id='li4bR'><q id='li4bR'></q></dir></style></legend>

                <tfoot id='li4bR'></tfoot>

                <small id='li4bR'></small><noframes id='li4bR'>

              1. <i id='li4bR'><tr id='li4bR'><dt id='li4bR'><q id='li4bR'><span id='li4bR'><b id='li4bR'><form id='li4bR'><ins id='li4bR'></ins><ul id='li4bR'></ul><sub id='li4bR'></sub></form><legend id='li4bR'></legend><bdo id='li4bR'><pre id='li4bR'><center id='li4bR'></center></pre></bdo></b><th id='li4bR'></th></span></q></dt></tr></i><div id='li4bR'><tfoot id='li4bR'></tfoot><dl id='li4bR'><fieldset id='li4bR'></fieldset></dl></div>
                  本文介绍了如何在 UItextView 中添加 placeHolder 文本?在 iphone sdk 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  可能重复:
                  UITextView 中的占位符

                  在 iPhone 应用程序中如何在 UItextView 中添加 placeHolder 文本(保存一些默认文本)?

                  In iPhone App How to add placeHolder Text (to hold some default text) in UItextView?

                  推荐答案

                  很简单,我就是这样做的.. 对我很好.. 希望这对某人有所帮助..

                  Simple, I did it this way.. working great for me.. Hope this helps some one..

                  #pragma mark -
                  #pragma mark TextView Delegate methods
                  
                  
                      UITextView itsTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, itsTextView.frame.size.width, itsTextView.frame.size.height)];
                              [itsTextView setDelegate:self];
                              [itsTextView setReturnKeyType:UIReturnKeyDone];
                              [itsTextView setText:@"List words or terms separated by commas"];
                              [itsTextView setFont:[UIFont fontWithName:@"HelveticaNeue" size:11]];
                              [itsTextView setTextColor:[UIColor lightGrayColor]];
                  
                  - (BOOL) textViewShouldBeginEditing:(UITextView *)textView
                  {
                      if (itsTextView.textColor == [UIColor lightGrayColor]) {
                          itsTextView.text = @"";
                          itsTextView.textColor = [UIColor blackColor];
                      }
                  
                      return YES;
                  }
                  
                  -(void) textViewDidChange:(UITextView *)textView
                  {
                      if(itsTextView.text.length == 0){
                          itsTextView.textColor = [UIColor lightGrayColor];
                          itsTextView.text = @"List words or terms separated by commas";
                          [itsTextView resignFirstResponder];
                      }
                  }
                  
                  - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
                  
                      if([text isEqualToString:@"
                  "]) {
                          [textView resignFirstResponder];
                          if(itsTextView.text.length == 0){
                              itsTextView.textColor = [UIColor lightGrayColor];
                              itsTextView.text = @"List words or terms separated by commas";
                              [itsTextView resignFirstResponder];
                          }
                          return NO;
                      }
                  
                      return YES;
                  }
                  

                  这篇关于如何在 UItextView 中添加 placeHolder 文本?在 iphone sdk 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Getting an NSArray of a single attribute from an NSArray(从 NSArray 获取单个属性的 NSArray)
                  ImageIO: lt;ERRORgt; JPEG Corrupt JPEG data: premature end of data segment iphone - how to catch this?(ImageIO:lt;错误gt;JPEG 损坏的 JPEG 数据:iphone 数据段过早结束 - 如何捕捉到这个?)
                  Xcode iOS organizer submit to app store yields quot;The archive is invalidquot; error(Xcode iOS 管理器提交到应用商店产生“存档无效;错误)
                  MFMessageComposeViewController alloc returns nil(MFMessageComposeViewController alloc 返回 nil)
                  How to add and get the values from .plist in iOS(如何在 iOS 中从 .plist 添加和获取值)
                  Mobile Device Management with iPhone(使用 iPhone 进行移动设备管理)

                  <small id='flU7I'></small><noframes id='flU7I'>

                  • <i id='flU7I'><tr id='flU7I'><dt id='flU7I'><q id='flU7I'><span id='flU7I'><b id='flU7I'><form id='flU7I'><ins id='flU7I'></ins><ul id='flU7I'></ul><sub id='flU7I'></sub></form><legend id='flU7I'></legend><bdo id='flU7I'><pre id='flU7I'><center id='flU7I'></center></pre></bdo></b><th id='flU7I'></th></span></q></dt></tr></i><div id='flU7I'><tfoot id='flU7I'></tfoot><dl id='flU7I'><fieldset id='flU7I'></fieldset></dl></div>

                  • <legend id='flU7I'><style id='flU7I'><dir id='flU7I'><q id='flU7I'></q></dir></style></legend>

                          <bdo id='flU7I'></bdo><ul id='flU7I'></ul>

                              <tbody id='flU7I'></tbody>
                            <tfoot id='flU7I'></tfoot>