从 SLPagingViewSwift VC 转出并关闭目标 VC 以返回 [英] Segue from a SLPagingViewSwift VC and dismiss the destination VC to return

查看:18
本文介绍了从 SLPagingViewSwift VC 转出并关闭目标 VC 以返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

***** 你可以

配置为执行转场的按钮(以模态呈现):

在目标 VC 中,我有一个按钮(上面标记为绿色方块):

 @IBAction func dissmissIt(_ sender: AnyObject) {解雇(动画:真实,完成:无)}

但是在目标 VC 被解散后,我看到第三个 VC 中的按钮位于不同的位置(更高):

布局已配置,按钮距顶部 40 个像素(与按钮距表格 8 个像素):

出了什么问题?

我猜初始布局配置考虑了 SLPagingViewSwift 导航栏,但在关闭后它会从屏幕顶部重新计算布局.

在保持布局设计的同时执行转场和关闭目标 VC 的正确方法是什么?

我看到了这个答案

但我不确定在哪里使用它.我试过了:

nav?.view.translatesAutoresizingMaskIntoConstraints = false

controller.view.translatesAutoresizingMaskIntoConstraints = false

但没有运气.

***** 你可以下载这个项目查看问题*****

谢谢.

解决方案

我遇到了同样的问题.经过很多小时的尝试修复它,我找到了解决方案.

  1. 点击你的转场
  2. 在右侧面板上单击显示属性检查器"
  3. 将演示选项设置为全屏显示".

为我工作.我希望它对你有用!

***** You can download this project to see the issue *****

I've embedded SLPagingViewSwift in my project. In the third VC i added a button (and a table):

The button configured to do a segue (Present Modally):

In the target VC i have a button (marked in square green above) that do:

 @IBAction func dissmissIt(_ sender: AnyObject) {

    dismiss(animated: true, completion: nil)
}

But after the target VC is dismissed i see the button in the third VC in a different location (higher):

The layout is configured, button 40 pixels from the top (and table 8 pixels from the button):

What went wrong?

I guess the initial layout configuration takes the SLPagingViewSwift navigation bar into consideration but after the dismiss it recalculates the layout from the top of the screen.

What is the right way to perform the segue and dismiss the target VC while keeping the layout as designed?

I saw this answer

But i was not sure where to use it. i tried:

nav?.view.translatesAutoresizingMaskIntoConstraints = false

and

controller.view.translatesAutoresizingMaskIntoConstraints = false

But with no luck.

***** You can download this project to see the issue *****

Thanks.

解决方案

I had the same problem. After a lot of hour trying to fix it, I found the solution.

  1. Click on your segue
  2. On the right panel click on 'Show the attributes inspector'
  3. Set the Presentation option to 'Over Full Screen'.

Worked for me. I hope it works for you!

这篇关于从 SLPagingViewSwift VC 转出并关闭目标 VC 以返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆