什么是@" some string"在目标c中意味着什么? [英] What does @"some string" mean in objective-c?

查看:130
本文介绍了什么是@" some string"在目标c中意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用iphone开发并遇到了一些使用@somestring的示例代码

I'm just starting out with iphone development and ran across some example code that used @"somestring"

someLabel.txt = @"string of text";

为什么字符串需要'@'?我猜它是创建对象的某种快捷方式?

Why does the string need the '@'? I'm guessing it's some kind of shortcut for creating an object?

推荐答案

它创建一个带有该字符串的NSString对象,而不是标准的c char *将在没有'@'

It creates an NSString object with that string as opposed to the standard c char* that would be created without the '@'

这篇关于什么是@" some string"在目标c中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆