画面に40個のUIViewタイルオブジェクトがあります。次に、View Controllerで、メッセージを使用してこれらのタイルを反転するルーチンがありtransitionFromView
ます。ループ内で一度にフリップすると、シミュレーターではスムーズに見えますが、iPhoneではフリップするのに苦労しています。これは、iPhoneのCPU / GPUが遅く、一度に多くのトランジションを処理できないためです。ですから、私が望んでいるのは、ある種のチェーントランジションを作成し、最終的にはいつでも5〜10にトランジションすることです。各フリップは0.4秒かかります。それを行う最も簡単な方法は何ですか?
2 に答える
0
UIViewtransition...
アニメーションメソッドはcompletion
ブロックを取ります。あなたのチェーンがあります。ブロックを並べて、チェーン内の連続する呼び出しの完了ブロックとして設定します。
または、グループ化されたアニメーションを作成します。
于 2013-03-07T00:22:06.307 に答える
0
私はおそらく、アニメーションを1つずつずらすというアプローチを取るでしょう。
NSArray *views
アニメーション化するすべてのビューでを維持し、シーケンスを次のように開始するだけです。[self transformViewAtIndex:[NSNumber numberWithInt:0]];
- (void)transformViewAtIndex:(NSNumber *)index {
// Make sure we're not out of bounds
if ([index intValue] >= [views count]) return;
// Get the view we want to work on
UIView *view = [views objectAtIndex:[index intValue]];
// Perform the animation
[UIView animateWithDuration:0.4 animations:^{ // Whatever duration you want
// ... This is where your actual transformation code goes
}];
// Schedule the next animation
NSNumber *newIndex = [NSNumber numberWithInt:[index intValue] + 1];
[self performSelector:@selector(transformViewAtIndex:) withObject:newIndex afterDelay:0.2]; // Set delay to a number that is effective
}
于 2013-03-07T02:26:27.680 に答える