Xcode 4.3 在视图之间传递变量 [英] Xcode 4.3 Passing Variables between Views
问题描述
Xcode 4.3 Storyboard 查询
Xcode 4.3 Storyboard query
我对 Xcode 比较陌生,对这个无害问题的各种解决方案完全感到困惑,在 Storyboard 设置中,这些解决方案都不适合我.在大多数非 Obj C 语言中,这是一个三行解决方案.
Hi, I'm relatively new to Xcode and am completely confused by the variety of solutions to this innocuous question, none of which are working for me in a Storyboard setup. In most non Obj C languages this is a three line solution.
如果视图 A 中有变量 X,我如何将 X 完整地传递给视图 B?
If I have variable X in view A how do I pass X to view B intact?
有人可以指出我使用 Storyboard 为 Xcode 4.3 中的有限数量的变量提供可靠的解决方案.
Could someone point me to robust solution for a limited number of variables in Xcode 4.3 using Storyboards.
我在频谱的另一端有另一个类似的查询,我需要将数百条数据传递给其他视图.然后我写到一个临时文件...
I have another similar query at the other end of the spectrum where I need to pass several hundreds of pieces of data to other views. Do I write then to a temp file...
TIA
推荐答案
HY,你需要在sender view controller中实现:
HY, You need implement in the sender view controller the:
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
//...//
}
函数,你可以在函数体中传递数据,如:
function, and you can pass the data in the function body like:
(ImageController *)( segue.destinationViewController).property=passed_data;
这篇关于Xcode 4.3 在视图之间传递变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!