ios - 我如何 swift 应用礼物正常工作

标签 ios swift viewcontroller

我在使用 swift 4 的应用程序中遇到了问题。 当我的字符串得到一个没有 nil 的值时,我想自动移动我的 View Controller 。 (促销)

然而它根本不起作用。

if(rst_str != nil){
    let nextView = storyboard?.instantiateViewController(withIdentifier: "viewListController") as! ViewListController

    //viewListController.delegate = self;

    print("log storyboard");

    self.present(nextView, animated: true, completion: nil);
}

“log storyboard”消息打印正常。 但是 self.present 行根本不起作用。

我该如何解决我的问题?

最佳答案

线

 self.present(nextView, animated: true, completion: nil);

在两种情况下不起作用

1- 您运行此行的当前 vc 当前未完全布局,例如在 viewDidLoad

中进行布局

2-当前vc当前正在呈现另一个vc

关于ios - 我如何 swift 应用礼物正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53976383/

相关文章:

objective-c - 确定 3G 与边缘

ios - 由于解包导致网络调用失败

ios - 插入 View 时显示白屏

xcode - 如何仅在某些覆盖上设置符号断点?

swift - NSURL、URL 和 NSData、数据

view - 如何在 iOS SDK4.2( Storyboard)中使用分段控件更改 View Controller ?需要示例代码

ios - 由于异步,在发布后连接到 MQTT

ios - 转换为使用 iOS 8 Popover Segues 时 UISplitViewController 崩溃

ios - 更改从 UIActivityViewController 打开的模态视图 Controller 的状态栏文本颜色

ios - 成功完成NSBundleResourceRequest之后,NSURL为零