以下代码在iOS12.2之前运行良好,它会向上滑动日历网格直到隐藏。
-(void) hideCalendarGrid {
[UIView animateWithDuration:10.0 delay:0 options:UIViewAnimationOptionAllowAnimatedContent animations:^{ //iwashere animation wrong iOS13. duration set to 10.0 for testing originally it was 0.2
CGRect collectionViewRect = self.collectionView.frame;
collectionViewRect.origin.y -= collectionViewRect.size.height;
self.collectionView.frame = collectionViewRect;
CGRect tableViewRect = self.tableView.frame;
tableViewRect.origin.y -= collectionViewRect.size.height;
tableViewRect.size.height += collectionViewRect.size.height;
self.tableView.frame = tableViewRect;
} completion:^(BOOL finished){
if (finished) {
// Reset frame but make it invisible
self.collectionView.hidden = YES;
self.collectionView.frame = self.collectionViewRectWhenVisible;
self.collectionViewHeightConstraint.constant = 0.0f;
self.isCalendarOn = NO;
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"isCalendarOn"];
[[NSUserDefaults standardUserDefaults] synchronize];
[self configureNavigationBar];
self.backButton.enabled = YES;
self.backButton.hidden = NO;
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"doneTutorial3.0CalendarGrid"]) {
[self showHowToHideCalendarGridTutorial];
}
}
}];
}
iOS 12.2演示(效果正常) https://youtu.be/sU5rbnujh3U
iOS 13演示(不是我想要的方式) https://youtu.be/mk3AFsh5FCw
有人知道如何使动画在iOS13上像iOS12一样工作吗?