这是我的NSLog的代码行:
NSLog(@"\n\noCLientFirstName: %@\nlastName: %@\nconcatenatedName: %@",oClientFirstName, lastName, concatenatedName);
为什么我的输出看起来像这样?
oCLientFirstName: <UITextField: 0xefe0330; frame = (394 293; 160 30); text = 'Bob'; clipsToBounds = YES; opaque = NO; autoresize = TM+BM; gestureRecognizers = <NSArray: 0xefe12d0>; layer = <CALayer: 0xefe0120>>
lastName: <UITextField: 0xef05bd0; frame = (20 40; 260 40); text = 'Jones'; clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0xef057c0>; layer = <CALayer: 0xef05ba0>>
concatenatedName: Bob<UITextField: 0xef05bd0; frame = (20 40; 260 40); text = 'Jones'; clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0xef057c0>; layer = <CALayer: 0xef05ba0>>
我以前从未遇到过这个问题;输出应如下所示:
oClientFirstName: Bob
lastName: Jones
concatenatedName: BobJones
发生了什么事?
答案 0 :(得分:3)
%@格式说明符将按位置的对象参数的顺序调用以下方法。 debugDescription 描述
你得到了对象的结果。
答案 1 :(得分:1)
这看起来就像是将UITextField
对象传递给日志函数而不是NSStrings。仔细检查类型并相应地调整代码。
答案 2 :(得分:0)
NSLog(@"\n\noCLientFirstName: %@\nlastName: %@\nconcatenatedName: %@",oClientFirstName.text, lastName.text, concatenatedName.text);
这是你问题的解决方案:)