简体   繁体   English

在iPhone中从一个视图弹出到另一个视图控制器时传递数据的问题

[英]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.

相关问题 如何从一个视图控制器弹出到另一个视图控制器 - How to pop from one view controller to another view controller 在不使用Segue的情况下将数据从一个视图控制器传递到另一个 - Passing data from one view controller to another without using Segue 将数据从 CollectionVewCell 传递到另一个视图 controller - Passing data from CollectionVewCell to another view controller iPhone 上的 UISplitViewController:从细节视图控制器弹出/显示主视图 - UISplitViewController on iPhone: pop to / show primary view from detail view controller 在iPhone上向Modal View Controller发送数据的问题 - Problem with sending data to Modal View Controller on iPhone iPhone-将对象从视图控制器传递到选项卡式视图控制器 - iPhone -Passing an object from a view controller to tabbed view controller 如何在IOS中将数据从一个视图传递到另一个视图控制器? - How to pass data from one view to another view controller in IOS? 点击注释时将数据传递给另一个视图控制器 - passing data to another view controller when tapping on annotation 目标C-将JSON数据从Tableview传递到另一个View Controller - Objective C - Passing JSON data from Tableview to another View Controller iOS6旋转问题:从另一个视图控制器弹出时,使我的视图保持直立 - iOS6 rotation issue: make my view stick to portrait when pop back from another view controller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM