UItextView 和 NSString
我有一个奇怪的错误。
MyController A
{
@ syntesize myUITextView;
}
MyController B {
MyControllerA *controller = ....
NSSTring *myString = " hello";
controller.myUITextView.text = myString;
NSLog(@"%@",myUITextView.text) = (null)
NSLog(@"%@",myString) = hello
}
当我打印controller.myUITextView时它是空的,请问我做错了什么?
谢谢四位的回答
I have a strange error.
MyController A
{
@ syntesize myUITextView;
}
MyController B {
MyControllerA *controller = ....
NSSTring *myString = " hello";
controller.myUITextView.text = myString;
NSLog(@"%@",myUITextView.text) = (null)
NSLog(@"%@",myString) = hello
}
when i print controller.myUITextView it's null, what i am doing wrong, please ?
thanks four your answers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
NSSTring *myString = " hello";
"hello"
不是 ObjectiveC 字符串,而是 C 字符串。您应该在前面添加@
,如下所示:@"hello"
NSSTring *myString = " hello";
"hello"
is not an ObjectiveC string, it's a C string. You should add@
before like this:@"hello"
试试这个
Try this
看来您没有记录您认为正在记录的内容。此行...
缺少控制器变量前缀,因此应该是:
It looks like you're not logging what you think you're logging. This line...
is missing the controller variable prefix so it should be:
您确定在
MyController A
中正确初始化了myUITextView
(或在 Interface Builder 中绑定了它)吗?似乎controller.myUITextView
为零。Are you sure that you initialize
myUITextView
inMyController A
(or bind it in Interface Builder) properly? Seems likecontroller.myUITextView
is nil.