A propriedade de quadro do UIView não está sendo atribuída dentro da animação no iOS
No meu aplicativo iOS, estou tentando executar a seguinte animação simples:
- (void)dismissToolbar
{
NSLog(@"bx: %f by: %f bw: %f bh: %f ",
toolbar.frame.origin.x,
toolbar.frame.origin.y,
toolbar.frame.size.width,
toolbar.frame.size.height);
CGRect tempRect = CGRectMake(0,
toolbar.frame.origin.y + toolbar.frame.size.height,
toolbar.frame.size.width,
toolbar.frame.size.height);
[UIView animateWithDuration:animationsDuration
delay:0
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowAnimatedContent
animations:^{
NSLog(@"bx: %f by: %f bw: %f bh: %f ",
tempRect.origin.x,
tempRect.origin.y,
tempRect.size.width,
tempRect.size.height);
toolbar.frame = tempRect; // frame value doesn't change here!
}
completion:^(BOOL finished) {
NSLog(@"bx: %f by: %f bw: %f bh: %f ",
toolbar.frame.origin.x,
toolbar.frame.origin.y,
toolbar.frame.size.width,
toolbar.frame.size.height);
NSLog(@"dismiss toolbar complete");
[toolbar setHidden:YES];
isPlayerToolbarActive = NO;
isDissmissingToolbar = NO;
}
];
[[NSNotificationCenter defaultCenter] postNotificationName:@"animateSidePanels" object:@"removingPlayerToolbar"];
}
Estou recebendo a seguinte saída em um console dos logs acima:
bx: 0.000000 por: 724.000000 bw: 1024.000000 bh: 44.000000
bx: 0.000000 por: 768.000000 bw: 1024.000000 bh: 44.000000
bx: 0.000000 por: 724.000000 bw: 1024.000000 bh: 44.000000
descartar a barra de ferramentas concluída
como você pode ver o valor do quadro não mudou ... e eu realmente não entendo o porquê ...
qualquer tipo de ajuda é muito apreciada!