OK, odpowiedzieć na własne pytanie.
skończyło się robi coś takiego:
// 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);
Mam nadzieję, że to może służyć jako przykład dla kogoś innego.
Czy nie można animować ich wszystkich naraz w dziale animacji, zamiast tworzyć wiele bloków? –
Nie, jeśli animacje mają różne czasy trwania i style – Goles
możliwe duplikowanie [sposobu wywoływania pojedynczego bloku ukończenia dla zagnieżdżonej grupy wywołań UIView animateWithDuration?] (Http://stackoverflow.com/questions/8421441/how-to-invoke -a-single-complete-block-for-a-nested-group-of-uiview-animatewith) –