アニメーションの配列を1つずつ内部関数に渡してお互いにアニメーションを入れ子にする必要はありません。お互いの完了ブロック。だから、私はこれをテストするための少しの方法を書いたし、どうしたのか、それは地獄のようにクラッシュする。しかし、なぜ私は理解していない。 、私はそれをデバッグする場合アニメーションの配列を渡すとアプリケーションがクラッシュする
NSMutableArray* animations = [NSMutableArray array];
[animations addObject:^{
CGRect frame = theTile.textField.frame;
frame.origin.x -= 10;
theTile.textField.frame = frame;
}];
、それは親切にすべての私のアニメーションを通過その完了ブロックで、最終的なアニメーションを呼び出して、クラッシュ:私はこのように、このアニメーションを渡し
+(void) internalAnimateWithArrayOfAnimationBlocks:(NSArray*) animationBlocks withIndex:(NSUInteger) index withCompletionAnimation:(void (^)(BOOL finished)) completionBlock {
__block NSArray* newAnims = animationBlocks;
__block NSUInteger theIndex = index;
if (index < [newAnims count] - 1) {
[UIView animateWithDuration:0.1 animations:^{
void (^animBlock) (void) = [newAnims objectAtIndex:theIndex];
animBlock();
theIndex++;
[RMAnimater internalAnimateWithArrayOfAnimationBlocks:newAnims withIndex:theIndex withCompletionAnimation:completionBlock];
}];
}
else {
[UIView animateWithDuration:0.1 animations:^{
void (^animBlock) (void) = [newAnims objectAtIndex:theIndex];
animBlock();
theIndex++;
} completion:completionBlock];
}
}
+(void) animateWithArrayOfAnimationBlocks:(NSArray*) animationBlocks withCompletionAnimation:(void (^)(BOOL finished)) completionBlock {
[RMAnimater internalAnimateWithArrayOfAnimationBlocks:animationBlocks withIndex:0 withCompletionAnimation:completionBlock];
}
:これは私の方法であり、致命的。私はここで間違って何をしていますか?
「クラッシュ致命的」はあまり具体的ではありません。何が起こるのですか? – Jim