Objective-C

Joined
Sep 19, 2008
Messages
302
Reaction score
4
Points
18
Location
Nottingham, UK
Your Mac's Specs
20" iM ac,13.3" Aluminium Unibody Macbook, iPhone 4
I'm a long time PHP, C++ and Java Developer but have just started creating my first iPhone app. I'm picking up Objective-C quite quickly but I have a few questions. Alot of syntax seems to have @ signs in it. For example...

Code:
myLabel.text = @"Hello, World!";

What is the @ sign for?

And there seems to be alternate ways of writing things for example this code does exactly the same as what I previously posted, whats the difference?

Code:
[myLabel setText:@"Hello, World!"];

Thanks
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Not an Obj-C programmer here so I can't interpret the meaning adequately but this site may help explain it. This may also help.
 
OP
eddielee
Joined
Sep 19, 2008
Messages
302
Reaction score
4
Points
18
Location
Nottingham, UK
Your Mac's Specs
20" iM ac,13.3" Aluminium Unibody Macbook, iPhone 4
Hadn't spotted that tutorial before so thanks for that. I'll look over the rest of it as well.

Sounds like the @ sign is used to tell the compiler to expect a literal value rather than a variable.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top