使用汉堡菜单时访问另一个viewcontroller中的变量的问题

时间:2017-08-16 07:25:05

标签: ios swift uiwebview parameter-passing swrevealviewcontroller

在某个viewcontroller中说'viewcontroller1',点击按钮我正在设置一个变量。现在我点击我的汉堡包按钮(使用SWRevealViewController创建)并转到另一个viewcontroller我想使用我在另一个viewcontroller中的viewcontroller1中设置的值。我怎样才能实现这一点......我也在使用swift。

1 个答案:

答案 0 :(得分:0)

您可以在App Delegate中设置一个变量,说...' myVariable'。在你的viewcontroller1'您可以将变量设置为' appDelegate.myVariable'。您也可以使用此格式从另一个viewcontroller访问该变量。