как вызвать функцию после завершения анимации

[self performSelector:@selector(callFunction) withObject:nil afterDelay:0 ]

в функции. - (недействительно) callFunction{

imageview = [[[UIImageView alloc] initWithFrame:CGRectMake(x,y,w,h)]autorelease];
imageview.image = [[UIImage imageNamed: [NSString stringWithString:name]]autorelease];
[self.view addSubview:imageview];
imageview.frame = CGRectMake(imageview.frame.origin.x, (imageview.frame.origin.y),    imageview.frame.size.width, imageview.frame.size.height);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
//[UIView setAnimationWillStartSelector:@selector(Transform2)];



[UIView setAnimationDuration:k_AnimateTime];

[UIView setAnimationBeginsFromCurrentState:YES];
//[UIView setAnimationDidStopSelector:@selector(increaseCount)];
imageview.frame = CGRectMake(imageview.frame.origin.x - Ex, (imageview.frame.origin.y - Ey), imageview.frame.size.width, imageview.frame.size.height);
    CGAffineTransform rotate0 = CGAffineTransformMakeRotation(0.00);
CGAffineTransform moveLeft0 = CGAffineTransformMakeTranslation(0.9,0.9);
CGAffineTransform combo10 = CGAffineTransformConcat(rotate0, moveLeft0);

CGAffineTransform zoomOut0 = CGAffineTransformMakeScale(1.1,1.1);
CGAffineTransform transform0 = CGAffineTransformConcat(zoomOut0, combo10);
imageView.transform = transform0;

[UIView commitAnimations];

[self.view addSubview:imageview];

}

Как вызвать функцию через 10 секунд с помощью NSTimer, но преобразование не работает. пожалуйста, предложите мне, как вызвать функцию после завершения анимации.


person avinash    schedule 11.04.2011    source источник


Ответы (1)


вы можете запустить таймер после завершения анимации. в вашем случае вы должны начать время как

[NSTimer scheduledTimerWithTimeInterval:k_AnimateTime target:self selector:@selector(yourfunction) userInfo:nil repeats:NO];
person saadnib    schedule 11.04.2011