0

を使用して表示しているものに追加CATransitionしたいUIViewControllersNSTimer

-(void)playAction:(id)sender
{
[audioPlayer play];
[self performSelector:@selector(displayviewsAction:) withObject:nil afterDelay:11.0];
}

- (void)displayviewsAction:(id)sender
{  
 First *firstController = [[First alloc] init];
 firstController.view.frame = CGRectMake(0, 0, 320, 480);
 [self.view addSubview:firstController.view];
 [self.view addSubview:toolbar];
 [firstController release];   
 self.timer = [NSTimer scheduledTimerWithTimeInterval:23 target:self selector:@selector(Second) userInfo:nil repeats:NO];     
 }

-(void)Second 
{
Second *secondController = [[Second alloc] init];
secondController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:secondController.view]; 
[self.view addSubview:toolbar];
[secondController release];
self.timer = [NSTimer scheduledTimerWithTimeInterval:27 target:self selector:@selector(Third) userInfo:nil repeats:NO];
}

最初から2番目などに変更されたときにCATransitionこれらに追加する方法.UIViewControllers

すべてのアイデアを前もって感謝します。

4

1 に答える 1

3

これを使って -

-(void)Second {
    Second *secondController = [[Second alloc] init];
    secondController.view.frame = CGRectMake(0, 0, 320, 480);

    CATransition *transitionAnimation = [CATransition animation];
    [transitionAnimation setDuration:1];
    [transitionAnimation setType:kCATransitionReveal];
    [transitionAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];

    [self.view.layer addAnimation:transitionAnimation forKey:kCATransitionReveal];

    [self.view addSubview:secondController.view];
    [self.view addSubview:toolbar];
    [secondController release];
    self.timer = [NSTimer scheduledTimerWithTimeInterval:27 target:self selector:@selector(Third) userInfo:nil repeats:NO];
}

CATransition//これで独自のアニメーションタイプを定義できます。

于 2012-05-19T17:29:49.233 に答える