Ok, um meine eigene Frage zu beantworten.
landete ich so etwas wie dies zu tun:
// Create dispatch queue & group
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_group_t group = dispatch_group_create();
// Two group enters
dispatch_group_enter(group);
dispatch_group_enter(group);
// (notice the group parameter in dispatch_group_leave)
[UIView animateWithDuration:0.3 animations:^{
self.pickerView.frame = CGRectMake(self.pickerView.frame.origin.x
, self.view.bounds.size.height + self.pickerView.frame.size.height/2
, self.pickerView.frame.size.width
, self.pickerView.frame.size.height);
} completion:^(BOOL finished){
dispatch_group_leave(group);
}];
[UIView animateWithDuration:0.3 animations:^{
self.navigationBar.frame = CGRectMake(self.navigationBar.frame.origin.x
, -self.navigationBar.frame.size.height
, self.navigationBar.frame.size.width
, self.navigationBar.frame.size.height);
} completion:^(BOOL finished){
dispatch_group_leave(group);
}];
// Finishing callback
dispatch_group_notify(group, queue, ^{
[self.view removeFromSuperview];
});
// Release the group
dispatch_release(group);
Ich hoffe, das sonst als ein Beispiel für jemanden dienen kann.
Konnten Sie sie nicht alle gleichzeitig im Animationsbereich animieren, anstatt mehrere Blöcke zu erstellen? –
Nicht, wenn die Animationen verschiedene Dauern und Stile haben – Goles
mögliche Duplikate von [wie ein einzelner Vervollständigungsblock für eine verschachtelte Gruppe von UIView animateWithDuration Aufrufen aufgerufen wird?] (Http://stackoverflow.com/questions/8421441/how-to-invoke -a-single-completion-block-for-a-nested-gruppe-of-uiview-animatewith) –