如何在 UILabel 中放入法语字符?
我正在从服务器获取 json,json 有一些属性,其中值是法语。当我将此法语字符串分配给 UILabel 时,它给了我空值。
我怎样才能把这个字符串放入 UILabel.
我正在这样做,
cell.title.text =[dealDictionary objectForKey:@"title"];
cell.description.text =[dealDictionary objectForKey:@"description"];
描述和标题都是法语。
I am fetching a json from server, json have some attributes where the value is in french. when I am assigning this french characters string to UILabel, it's giving me null.
How can I put this string in UILabel.
I am doing like this
cell.title.text =[dealDictionary objectForKey:@"title"];
cell.description.text =[dealDictionary objectForKey:@"description"];
description and title both are in French.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您确定
cell.title
存在并且它就是您所认为的那样吗?要说服自己这应该有效,请像这样更改代码:如果这不起作用,则
cell
或cell.title
有问题。如果这有效,但您的代码不起作用,那么
[dealDictionary objectForKey:@"title"]
是什么类型的对象可能有些有趣。尝试将其分配给 NSString 并查看执行时会得到什么。换句话说,您在一行代码中做出了太多假设。分解每个假设并进行测试。这就是如何调试。
Are you certain that
cell.title
exists and that it is what you think it is? To persuade yourself that this should work, change your code like this:If that doesn't work, there's something wrong with
cell
or withcell.title
.If that works but your code doesn't, then perhaps there is something funny about what kind of object
[dealDictionary objectForKey:@"title"]
is. Try assigning it to an NSString and see what you get when you do.In other words, you are making too many assumptions in a single line of code. Break down each assumption and test it. That is How To Debug.
您使用了错误的属性来设置文本。请务必检查文档 。
为了使detailTextLabel可见,它需要是支持它的样式。
UITableViewCellStyleValue1
UITableViewCellStyleValue2
UITableViewCellStyleSubtitle
You are using the wrong property to set the text. Make sure you check the documentation.
For the detailTextLabel to be visible it needs to be a style that supports it.
UITableViewCellStyleValue1
UITableViewCellStyleValue2
UITableViewCellStyleSubtitle