更改视图 将变量编程为视图

  • 本文关键字:视图 编程 变量 ios swift
  • 更新时间 :
  • 英文 :


我有一个函数可以正确更改视图,但它并未将变量传递给下一个视图。我真的不是Swift的专家,我不知道我的代码中的错误在哪里:

let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let newViewController = storyBoard.instantiateViewController(withIdentifier: "PaymentVC") as! PaymentViewController
self.present(newViewController, animated: true, completion: nil)
    newViewController.num_pal = num_words
    newViewController.l_origen = l_source
    newViewController.l_destino = l_target
    newViewController.espec = espec
    newViewController.user = user
    newViewController.pass = pass
    newViewController.texto = texto
    newViewController.modificado = modificado
    newViewController.texto_ant = texto_ant

非常感谢您的帮助。

self.present(newViewController, animated: true, completion: nil)应该是在传递数据之后,只需将其 newViewController.texto_ant = texto_ant

添加。

最新更新