我试图在包含动画块的方法中返回一个值。我在下面的代码工作得很好,但似乎应该有更好或更清洁的方法来做到这一点。有一个更好的方法吗?
+ (BOOL) flipImageAndTextForView:(UIView *) viewFlipImageAndText IsImageDisplayed:(BOOL) imageFlipDisplayed flipTextView:(UITextView *) textViewDonate flipImage: (UIImageView *)pictureImage{
__block BOOL tempBool;
[UIView transitionWithView:viewFlipImageAndText
duration:0.3f
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^(void) {
if (imageFlipDisplayed)
{
[viewFlipImageAndText bringSubviewToFront:textViewDonate];
tempBool = FALSE;
}
else
{
[viewFlipImageAndText bringSubviewToFront:pictureImage];
tempBool = TRUE;
}
}
completion:^(BOOL finished) {
NSLog(@"Done!");
}];
if(tempBool)
{
return TRUE;
}
else{
return FALSE;
}
}