【问题标题】:Textfield value Issue in IOSIOS中的文本字段值问题
【发布时间】:2017-09-15 12:26:42
【问题描述】:

我将用户的姓名和电子邮件地址存储在 NSUserdefault 中,它来自服务并将其传递给另一个 VC,但是当我 NSLog 它时,它向我显示了这一点,

<UITextField: 0x7f8d6548bcf0; frame = (16 366; 185 30); text = 'Shoaib Anwar'; clipsToBounds = YES; hidden = YES; opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x608000254ca0>; layer = <CALayer: 0x60800022b480>>

以前它工作正常,但我不知道为什么它现在不能正常工作。

【问题讨论】:

  • 你怎么打印这个,显示你的NSLog("")代码

标签: ios objective-c uitextfield


【解决方案1】:

如果您想要 UITextFieldtext 属性,请在 NSLog 上使用 yourcurrentTextfieldname.text

NSLog(@"get text value  == %@",yourcurrentTextfieldname.text);

它会给出 OP 的

get text value  == Shoaib Anwar

但如果你使用 like textfield 属性

NSLog(@"get text value  == %@",yourcurrentTextfieldname);

然后你得到文本字段的整个属性的 OP。

 get text value == <UITextField: 0x7f8d6548bcf0; frame = (16 366; 185 30); text = 'Shoaib Anwar'; clipsToBounds = YES; hidden = YES; opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x608000254ca0>; layer = <CALayer: 0x60800022b480>>

【讨论】:

  • 兄弟,我正在运行我的应用程序并使用现有代码 1 获取 Mach Linker 错误链接器命令。@Anbu.Karthik
  • 解决了,得到了兄弟,非常感谢。 @Anbu.Karthik
  • @Oneeb - 很高兴听到这个兄弟
【解决方案2】:

你不应该打印 TextField 对象,它应该是TextFiled text property

NSLog(@"value  == %@",textField.text);

【讨论】:

    猜你喜欢
    • 2011-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-30
    • 1970-01-01
    • 2013-06-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多