Iphone 闪烁隐藏和使用块
我的方法是:Iphone 闪烁隐藏和使用块,iphone,ios,core-animation,objective-c-blocks,Iphone,Ios,Core Animation,Objective C Blocks,我的方法是: - (void)blinkView:(UIView *)view { view.layer.opacity = 0.0f; view.hidden = NO; [UIView beginAnimations:@"Blinking" context:nil]; [UIView setAnimationRepeatCount:1.0]; [UIView setAnimationDuration:0.6f]; [UIView setAni
- (void)blinkView:(UIView *)view
{
view.layer.opacity = 0.0f;
view.hidden = NO;
[UIView beginAnimations:@"Blinking" context:nil];
[UIView setAnimationRepeatCount:1.0];
[UIView setAnimationDuration:0.6f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
view.layer.opacity = 1.0f;
[UIView commitAnimations];
}
如何使用块编写此代码,以及如何实现具有相反效果的方法(使用闪烁隐藏uiview)
或
可以通过递归调用动画块来设置重复计数(请参见)
希望它能帮助你
或
可以通过递归调用动画块来设置重复计数(请参见)
希望它能对您有所帮助。您可以使用UIView的setAnimationDelegate:和setAnimationDidStopSelector:
[UIView beginAnimations:@"Blinking" context:nil];
[UIView setAnimationRepeatCount:1.0];
[UIView setAnimationDuration:0.6f];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
view.layer.opacity = 1.0f;
[UIView commitAnimations];
- (void) animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
// add your final code here : you can give new animation effect here.
}
或者尝试使用持续时间设置动画(仅适用于iOS 4或更高版本)
您可以使用UIView的setAnimationDelegate:和setAnimationDidStopSelector:
[UIView beginAnimations:@"Blinking" context:nil];
[UIView setAnimationRepeatCount:1.0];
[UIView setAnimationDuration:0.6f];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
view.layer.opacity = 1.0f;
[UIView commitAnimations];
- (void) animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
// add your final code here : you can give new animation effect here.
}
或者尝试使用持续时间设置动画(仅适用于iOS 4或更高版本)
[UIView beginAnimations:@"Blinking" context:nil];
[UIView setAnimationRepeatCount:1.0];
[UIView setAnimationDuration:0.6f];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
view.layer.opacity = 1.0f;
[UIView commitAnimations];
- (void) animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
// add your final code here : you can give new animation effect here.
}
[UIView animateWithDuration:0.6f
animations:^{
view.layer.opacity = 1.0f;
}
completion:^(BOOL completed){
// add your final code here : you can give new animation effect here.
}
];