gpt4 book ai didi

使用performSegueWithIdentifier时的Swift UIImageView错误

转载 作者:行者123 更新时间:2023-11-30 10:05:55 29 4
gpt4 key购买 nike

我有 FirstViewController 用于识别用户。用户写入数据并按下按钮后,请求发送到服务器,如果响应是肯定的,我想打开 SecondViewController,其中包含 UIImageView (它的图像在 Assets 中声明)。

所以当我尝试

self.performSegueWithIdentifier("openSecond", sender: self)

UIImageView 为空。一段时间后,图像会自行加载(或者如果我切换其突出显示参数)。

如果我尝试通过单击按钮打开 SecondViewController(使用相同的 segue,但来自 InterfaceBuilder),它会立即打开并且 UIImageView 显示其图像。

这是我的 UIImageView 配置: UIImageView configuration

我该如何解决这个问题?

最佳答案

你应该尝试这个:

dispatch_async(dispatch_get_main_queue(),{
self.performSegueWithIdentifier(mysegueIdentifier,sender: self)
})

Some people ran into this kind of problem ,但我无法解释其真正原因。欢迎评论和编辑。

关于使用performSegueWithIdentifier时的Swift UIImageView错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35983528/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com