OGeek|极客世界-中国程序员成长平台

标题: ios - 从不同的 xib 获取 UITextField 值 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 21:46
标题: ios - 从不同的 xib 获取 UITextField 值

我知道如何从 UITextField 中获取文本,所以这不是问题。我的问题是如何从不同的 XIB 文件中获取其值?

例如:我的 Form.xib 中有一个名称文本字段,我试图从 Chart.xib

中提取该名称值



Best Answer-推荐答案


使 UItextField 在其相应的 View Controller (假设是 View A)中成为 IBOutlet (@property) ..then ..

让我们说你想要 View B 中文本文件的值。

所以在 View B 中。

ViewA *viewA = [[ViewA alloc]initwithnibName"ViewA" bundle:nil];

NSString *textfieldtext = viewA.textfieldNamehere.text;

关于ios - 从不同的 xib 获取 UITextField 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9589692/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4