Xcode:情节提要和在每个控制器中保留数据 [英] Xcode : Storyboard and retaining data in each controller

查看:39
本文介绍了Xcode:情节提要和在每个控制器中保留数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以猜到我是一名新程序员,我很难获得简单的东西!我正在制作具有多个视图控制器的应用程序.每个控制器都有文本字段和UIsegmentedControl项.当我从一个视图控制器移动到另一个视图控制器时(如果这很重要,则为模态转换),上一个视图控制器的内容(文本字段条目和分段控制选项)将重置为其原始状态.我如何让他们保持以前的状态?预先感谢.

As you can guess i am a new programmer and i have trouble getting a simple thing! I am making an app with multiple view controllers. Each controller have textfields and UIsegmentedControl items. When i am moving from one view controller to the other (uding modal trantition if that matters), the contents of the previous one (textfield entries and segmented control option) reset to their original state. How can i make them keep their previous state? Thanks in advance.

推荐答案

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    bViewController *deneme = [segue destinationViewController];
    [deneme setPassedValue:label.text];
}

我希望这段代码可以解决您的问题.它保存其中任何内容的标签.并且您需要向其他类添加更多代码.

This piece of code will solve your problem, I hope. It saves the label of whatever is inside of it. And you need to add some more code to other classes.

如果此代码可以帮助您告诉我,我可以为您提供整个代码.

If this code helps you tell me and I can give you the whole code.

这篇关于Xcode:情节提要和在每个控制器中保留数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆