Objective-C

From Wikicliki
Revision as of 09:17, 21 February 2013 by WikiSysop (talk | contribs)

Jump to: navigation, search

Objective-C is a superset of C language and it is called objective-c because it is a object-oriented language.

What one needs in order to program in Objective-C

  • Source Code Editor (Xcode)
  • Compiler (Xcode)
  • Program to design the interface (Interface Builder - which is now built into Xcode)
  • Debuggers (Instruments)

Get Xcode

Basics

Data types in Objective-C

  • int (integer)
  • unsigned int
  • float (floating point number)
  • double (double precision)
  • char (a, b, c)
  • string ("a string")
  • bool (true/false)

Initialisation

int myInteger; int myInteger = 42; int myInteger, myInteger2, myInteger3;

Operators

operators - as normally expected except there is also "modulo" % - result will be the remainder from the integer division of the 1st by the 2nd (only for int or long, insert some caveat here about floats and doubles and using fmod) eg: int moduloResult = a % b;

NSLog

See also