Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 闪烁隐藏和使用块_Iphone_Ios_Core Animation_Objective C Blocks - Fatal编程技术网

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)

可以通过递归调用动画块来设置重复计数(请参见)

希望它能帮助你

可以通过递归调用动画块来设置重复计数(请参见)


希望它能对您有所帮助。

您可以使用UIViewsetAnimationDelegate: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或更高版本)


您可以使用UIViewsetAnimationDelegate: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.
                                              }
                                           ];