我正在第二個視圖控制器中的動畫應用程序。動畫完成後,我試圖自動延續到下一個視圖控制器。我在完成布爾成功不工作
完成SEGUE:^(BOOL成功){...
,但它無法正常工作。然後我嘗試了一個簡單的NSLog @「但是這也不起作用,我猜測問題在於BOOL沒有完成或註冊成功,我發生的動畫和結束......但完成BOOL是沒有進行。請幫助。
從secondViewController的.m文件...
#import "secondViewController.h"
@interface secondViewController()
@property (nonatomic,weak) IBOutlet UIImageView *animatedImage;
@end
@implementation secondViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)viewDidAppear:(BOOL)animated
{
[self moveUp:nil finished:nil context:nil];
}
- (void)moveUp:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
[UIView animateWithDuration:2.0
delay:1.0
options: (UIViewAnimationCurveEaseInOut|UIViewAnimationOptionAllowUserInteraction)
animations:^{
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(moveDown:finished:context:)];
self.animatedImage.center = CGPointMake(160, 304);
}
completion:^(BOOL finished){
NSLog(@"Move up done");
}];
}
- (void)moveDown:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
[UIView animateWithDuration:2.0
delay:1.5
options: (UIViewAnimationCurveEaseInOut|UIViewAnimationOptionAllowUserInteraction)
animations:^{
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(moveUp:finished:context:)];
self.animatedImage.center = CGPointMake(160, 775);
}
completion:^(BOOL finished){
[self performSegueWithIdentifier:@"backHome" sender:self];
}];
}
@end
你能告訴我們多一點的代碼嗎?作爲例子,你創建動畫 – drolando