次のコードに問題があります。実行すると、最初とで未定義の遅延があります。そこで何が起こっているのかわかりません。これは、アプリがデバイスで実行されている場合にのみ発生します。[CATransaction commit]
CompletionBlock:
タイムログはこちら
2013-04-22 15:59:50.893 MyApp[27038:907] ***** A
2013-04-22 **15:59:50.894** MyApp[27038:907] ***** B
2013-04-22 **15:59:53.161** MyApp[27038:907] ***** C
2013-04-22 15:59:53.162 MyApp[27038:907] ***** D
2013-04-22 15:59:53.164 MyApp[27038:907] ***** E
2013-04-22 15:59:53.967 MyApp[27038:907] ***** F
-
NSLog(@"***** A");
[CATransaction begin];
[CATransaction setCompletionBlock:^{
[CATransaction begin];
NSLog(@"***** D");
for (UIView *view in [masterTableView subviews])
{
if (view.tag == 501)
{
[view removeFromSuperview];
break;
}
}
[self.view sendSubviewToBack:masterTableView];
[self.view bringSubviewToFront:detailView];
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionPush];
[animation setDuration:.8];
[animation setSubtype:transitionFromRight?kCATransitionFromRight:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[CATransaction setCompletionBlock:^{
NSLog(@"***** F");
for (UIView *view in [detailView subviews])
{
if (view.tag == 502)
{
[view removeFromSuperview];
break;
}
}
[self addDetailView];
[self.view sendSubviewToBack:detailView];
[self.view bringSubviewToFront:masterTableView];
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionPush];
[animation setDuration:.8];
[animation setSubtype:transitionFromRight?kCATransitionFromRight:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[detailView layer] addAnimation:animation forKey:@"transition"];
}];
[[masterTableView layer] addAnimation:animation forKey:@"transition"];
NSLog(@"***** E");
}];
[CATransaction begin];
[CATransaction setCompletionBlock:^{
NSLog(@"***** C");
for (UIView *view in [self.view subviews])
{
if (view.tag == 500)
{
[view removeFromSuperview];
break;
}
}
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionPush];
[animation setDuration:0];
[animation setSubtype:transitionFromRight?kCATransitionFromRight:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[dummyView layer] addAnimation:animation forKey:@"transition"];
}];
[CATransaction commit];
[CATransaction commit];
NSLog(@"***** B");
私は何かを間違えましたか?? 助けてください。