[英]problem in passing data when pop from one view to another view controller in iphone
I am having a application in which one view controller is pushed and when we pop from the pushed controller i do not get the value for the variable 我有一个应用程序,其中一个视图控制器被推入,当我们从推入的控制器弹出时,我没有得到变量的值
For eg consider there is A controller in which i am havinh the int variable named Component now i push to B Controller on click event of button from A Controller ,When we are pushed to B view there is Table View and when i select any of the cell i just pass indexpath.row value to the int component and here i print value of component value which is correct , now when its pop to A controller again i print the value of component which comes to be 0(zero) always.. Where am i wrong 例如,考虑一个A控制器,我现在是一个名为Component的int变量,当我从A控制器单击按钮时,我将其推到B控制器上。当我们推到B视图时,将看到表视图,当我选择任何一个单元格,我只是将indexpath.row值传递给int组件,在这里我打印正确的组件值,现在当它再次弹出到A控制器时,我将始终打印组件值为0(零)。我错了吗
Without seeing any code I would say that you haven't set up a reference to controller A in controller B so when you are calling A.someInt = 5 nothing is happening. 没有看到任何代码,我会说您尚未在控制器B中设置对控制器A的引用,因此,当您调用A.someInt = 5时,什么都没有发生。 Unlink other languages, calling a method on a nil reference just returns nil. 取消链接其他语言,在nil引用上调用方法只会返回nil。 It doesn't throw an error. 它不会引发错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.