我正在使用最新的iOS 7动画转换协议,以便创建一个视频控制器的淡入淡出过渡;班级成员PSSpaceDetailViewController
。但是,对于所有其他推送转换,我想使用UINavigationController
通常提供的默认推送动画。
然而,实现了以下代码才能做到这一点,当我从上述类中推出一个单独的视图控制器时,我收到一个奇怪的延迟震动动画。任何想法为什么会这样?我上传了一段简短的视频,展示了我想要描述的动画,希望能更容易理解这个错误:http://d.pr/v/Q754
//PSAnimatngNavigationControllerDelegate.m
+ (instancetype) sharedInstance {
static PSAnimatingNavigationControllerDelegate *shared;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shared = [[PSAnimatingNavigationControllerDelegate alloc] init];
});
return shared;
}
- (PSFadeAnimator *) animator {
if (!_animator) {
_animator = [[PSFadeAnimator alloc] init];
}
return _animator;
}
- (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC
{
if (operation == UINavigationControllerOperationPush && [toVC isKindOfClass:[PSSpaceDetailViewController class]]) {
return self.animator;
}
return nil;
}
// App Delegate.m
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:notesViewController];
[navigationController setDelegate:[PSAnimatingNavigationControllerDelegate sharedInstance]];
PSSpaceDetailViewController.m
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
PSMatchDetailViewController *matchDetail = [[PSMatchDetailViewController alloc] initWithOriginalSpace:self.space andPotentialLead:self.datasource[indexPath.section][indexPath.row]];
[self.navigationController pushViewController:matchDetail animated:YES];
}
答案 0 :(得分:0)
您正在推送的视图控制器具有nil
背景颜色,默认情况下在iOS 7上清除。只需将其设置为白色或其他任何颜色即可。