【问题标题】:How can I slide text from left to right in iPhone?如何在 iPhone 中从左向右滑动文本?
【发布时间】:2011-03-22 13:46:50
【问题描述】:

如何在 iPhone 中从左向右滑动文本?

【问题讨论】:

    标签: iphone objective-c cocoa-touch animation


    【解决方案1】:
    [label setFrame:CGRectMake(278, 32, 42, 29)];    // Right most position  
    [UIView beginAnimations:nil context:nil]; 
    
    [UIView setAnimationDuration:0.5]; 
    [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
    [label setFrame:CGRectMake(0, 20, 42, 29)];  //left most position
    [UIView commitAnimations];
    

    【讨论】:

      【解决方案2】:

      你可以在 Label 的位置使用 UIView 动画:

      [UIView beginAnimations];
      CGRect fr = label.frame;
      fr.origin.x = target_x_position;
      label.frame = fr;
      [UIView commitAnimation];
      

      【讨论】:

        【解决方案3】:

        为此,您需要在滚动视图中使用 UILabel 或 UITextView。 生成具有必要宽度的滚动视图并将 UITextView 作为 addSubView 添加到此滚动视图。

        <UIScrollViewDelegate> //set the delegate of ScrollView to call it's delegate methods and allow paging to be done in ScrollView.
        
        -(void)ScrollViewdidScroll:(UIScrollView *)UIScrollV
        {
        
        }
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2010-10-10
          • 1970-01-01
          • 1970-01-01
          • 2013-03-17
          • 1970-01-01
          • 2011-03-12
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多