【问题标题】:Custom UIViewControllerContextTransitioning and black screen [duplicate]自定义 UIViewControllerContextTransitioning 和黑屏 [重复]
【发布时间】:2015-11-17 05:01:22
【问题描述】:

我有一个 UITableViewController,在我的 UITableViewCell 内,当用户点击它时,我有一个 imageView,我使用我自己的自定义 UIViewControllerContextTransitioning 模态地呈现它以对其进行缩放效果,它就像一个魅力,问题是当动画完成,我调用了

[transitionContext completeTransition:YES];

现在位于 Modal UIViewController 后面的 UITableView 已从视图层次结构中移除,因此我在其后面出现黑屏

 [containerView addSubview:toViewController.view];
 [UIView animateWithDuration:duration delay:0.0 usingSpringWithDamping:damping initialSpringVelocity:1.0 / damping options:0 animations:^{
    // blablabla animation stuff
 } completion:^(BOOL finished) {
   [transitionContext completeTransition:YES];// this line makes my UITableView removed form the view hierarchy 
 }];

这是我迄今为止尝试过的:

在完成块中添加 UITableView

  [[UIApplication sharedApplication ].keyWindow insertSubview:fromViewController.view belowSubview:containerView];

但这仅适用于 iOS8 ...

任何想法如何解决这个问题?谢谢!!

【问题讨论】:

标签: ios objective-c uitableview cocoa-touch core-animation


【解决方案1】:

尝试将当前视图控制器的modalPresentationStyle设置为UIModalPresentationCustom

【讨论】:

  • 它设置为 UIModalPresentationCustom 我尝试了其他值,但它也不起作用
猜你喜欢
  • 1970-01-01
  • 2011-07-28
  • 2017-07-26
  • 2017-02-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多