iPhone 开发:如何将信息从一个 .m 文件传输到另一个
我是 iPhone 开发新手,我有一个程序,有 7 个 UITextFields 可见在此处输入代码
。当用户在 UIPicker 视图(1-5)上选择一个数字时,许多 UITextField 会变得隐藏且无法使用。该程序运行良好。我想要从该 .m 文件中选取相同的数字并将其传输到另一个 .m 文件,以便 1-5 UITextFields 被隐藏且无法使用。如果重要的话,第一个 .m 文件是 abc.m,第二个是 bca.m 如果重要的话我使用 [textfield sethidden= YES]
谢谢
I am new to iPhone development, I have a program that has 7 UITextFields visableenter code here
. When the user picks a number on the UIPicker View (1-5) that many UITextFields become hidden and unusable. That program works well. I want to have the same number that was picked from that .m file and transfered to another .m file so that 1-5 UITextFields are hidden and unusable. If it matters, the first .m file is abc.m and the second one is bca.m
if it matters I use [textfield sethidden= YES]
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要保留对类中所有这些对象的引用,并为它们定义属性,以便您可以在第二个 .m 文件中引用它们。
因此,假设您有一个类 abc.m
那么您可以使用 text1 属性来引用该文本字段,前提是您已经在第二个类中实例化了该对象,或者保存了对它的引用。
You need to keep references to all those objects in the class, and define properties to them so that you can refer to them in the second .m file.
So assuming you have a classes, abc.m
Then you can use the text1 property to refer to that text field, given that you have instantiated the object in the second class, or hold a reference to it.
我的班级
MyClass
您可以尝试创建一个 BOOL 或多个 BOOL 变量,并将其设置为 YES 或 NO,然后将其放入文本字段中。
然后如果您使用pushViewController,您可以将bca.m中的isVisible设置为等于abc.m中的isVisible
You could try making a BOOL or several BOOL variables and set it equal to YES or NO then put that into your text fields.
and then if you use a pushViewController you can set the isVisible from bca.m equal to the isVisible in abc.m