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

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

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

      1. 以编程方式使 uitextview 滚动

        时间:2023-10-23

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

              <legend id='pn19I'><style id='pn19I'><dir id='pn19I'><q id='pn19I'></q></dir></style></legend>
              <tfoot id='pn19I'></tfoot>
                <tbody id='pn19I'></tbody>

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

                • 本文介绍了以编程方式使 uitextview 滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想让我的 uitextview 在应用程序启动时自动滚动.谁能帮我详细的代码?我是 iPhone SDK 的新手.

                  I want to make my uitextview to scroll automatically whenever the application is launched. Can anyone help me with a detailed code? I am new to iPhone SDK.

                  推荐答案

                  .h文件

                  @interface Credits : UIViewController 
                  {
                      NSTimer *scrollingTimer;
                  
                      IBOutlet UITextView *textView;
                  
                  
                  }
                  @property (nonatomic , retain) IBOutlet UITextView *textView;
                  
                  - (IBAction) buttonClicked ;
                  
                  - (void) autoscrollTimerFired;
                  
                  @end
                  

                  .m 文件

                  - (void) viewDidLoad
                  {       
                      // it prints the initial position of text view 
                      NSLog(@"%f %f",textView.contentSize.width , textView.contentSize.height);
                  
                      if (scrollingTimer == nil)
                      {
                          // A timer that updates the content off set after some time so it can scroll 
                          // you can change time interval according to your need (0.06)
                          // autoscrollTimerFired is the method that will be called after specified time interval. This method will change the content off set of text view
                          scrollingTimer = [NSTimer scheduledTimerWithTimeInterval:(0.06)
                                           target:self selector:@selector(autoscrollTimerFired) userInfo:nil repeats:YES];        
                      }
                  }
                  
                  - (void) autoscrollTimerFired
                  {
                      CGPoint scrollPoint = self.textView.contentOffset; // initial and after update
                      NSLog(@"%.2f %.2f",scrollPoint.x,scrollPoint.y);
                      if (scrollPoint.y == 583) // to stop at specific position 
                      {
                          [scrollingTimer invalidate];
                          scrollingTimer = nil;
                      }
                      scrollPoint = CGPointMake(scrollPoint.x, scrollPoint.y + 1); // makes scroll
                      [self.textView setContentOffset:scrollPoint animated:NO];
                      NSLog(@"%f %f",textView.contentSize.width , textView.contentSize.height);
                  
                  }
                  

                  希望对你有帮助....

                  Hope it helps you....

                  这篇关于以编程方式使 uitextview 滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在横向模式下飞溅(启动图像)? 下一篇:iphone-sdk:向 UIAlertview 添加文本字段在 iOS 4 中不起作用?

                  相关文章

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

                    <tfoot id='cpcfo'></tfoot>
                  1. <legend id='cpcfo'><style id='cpcfo'><dir id='cpcfo'><q id='cpcfo'></q></dir></style></legend>

                    1. <small id='cpcfo'></small><noframes id='cpcfo'>

                      • <bdo id='cpcfo'></bdo><ul id='cpcfo'></ul>