2011-01-28 10 views
0

UIScrollView(scrollView)内のサブビューであるUITextView(myTextView)をアニメーション化しようとしています。サブビューであるUITextViewをアニメーション化する方法は?

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:1]; 
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:myTextView cache:YES]; 
[scrollView addSubview:myTextView]; 
[UIView commitAnimations]; 

myTextViewはアニメーションなしで表示されます。

+0

'addSubview:'は単独で何もアニメーション化しません。どのように正確にテキストビューを表示したいですか? – BoltClock

+0

私はUIViewAnimationTransitionCurlDownで表示するtextviewします。これどうやってするの? – JTheIslander

答えて

1

どのようなアニメーションをやりたいですか?たとえば、フェードインしたい場合は、行う必要があります。


[scrollView addSubview:myTextView]; 
myTextView.alpha = 0.0; 
[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:1]; 
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:myTextView cache:YES]; 
myTextView.alpha = 1.0; 
[UIView commitAnimations]; 

アニメーションを作成するためにいくつかのプロパティ(フレーム、トランスフォームなど)を変更できます。

+0

フェードインはうまくいきます、ありがとうございます:-) しかし、どのようにTextViewをUIViewAnimationTransitionCurlDownで表示させることができますか? – JTheIslander

0

http://www.4shared.com/dir/-PGqZEXR/zoominzoomout.htmlちょうどあなたのプロジェクトにこのファイルを追加し、それを呼び出し、この関数を使って

ここIM2はUIViewのであり、現在、これを添付し、私はそれが、この

- (void)viewDidLoad { 
    [self loadFlowersInView:im2]; 
    [self.view addSubview:im2]; 
} 

のようなビューdidloadを介してこれを渡しに画像を貼り付けますこのような関数

- (void) loadFlowersInView: (UIView *) backdrop { 
     NSString *create_button = nil; // Add the flowers to random points on the screen 
     for (int i = 0; i < 1; i++) { 
      MagPicAppDelegate *appdelegate = (MagPicAppDelegate *)[[UIApplication sharedApplication] delegate]; 
      NSString *whichFlower = appdelegate.imageName; 
      UIImage *stemp = [UIImage imageNamed:@"approve.png"]; 
      DragView *dragger = [[DragView alloc] initWithImage:stemp]; 
      dragger.userInteractionEnabled = YES; 
      dragger.center = CGPointMake(160.0f, 140.0f); 
      [im2 addSubview:dragger]; 
      [dragger release]; 
     } 

     [self.view addSubview:im2]; 
     [im2 release]; 
} 
関連する問題