Skip to content

iOS & Objective C programming Notes & Links

Chris edited this page Jan 30, 2018 · 7 revisions

A collection of notes written by me while developing KegCop

Definitions

  • Objective-C - a collection of syntactic extensions to the C programming language to add objects.
  • Application Life Cycle - main() → UIApplicationMain() → UIApplication Object → event loop listening to user input
  • Protocol - is a set methods an object agrees to implement.

Fun Facts

  • Objective-C is a dynamically linked language.
  • There are over 3000 methods and more than 200 classes available in iOS.
  • XIB is pronounced zib
  • NSObject - the root class of the entire class hierarchy
  • .mm - denotes an Objective-C++ file.

Useful Links

Code Examples

Hello, World! - Objective-C
#include 

int main(int argc, char *argv[]) { printf(“hello, world\n”); return 0; }

Hello, World! - C++
#include 
int main()
{
    std::cout << “Hello, world!\n”;
}
Hello, World! - Java
public class Hello {
    public static void main(String[] args) {
        System.out.println(“Hello, world!”);
    }
}

Comparing Objective-C message sending to other OO languages

  • C++: someObject->doSomething();
  • Java: someObject.doSomething();
  • Objective-C: [someObject doSomething];

Methods and messages

To call a method in Objective-C

[myObject someMethod];

To pass arguments

[myObject someMethod:arg];

Managing the build version of iOS app

Useful commands with working the build version of an app

agvtool
agvtool what-version
agvtool bump -all

To change the marketing version

agvtool new marketing-version <0.4.2>

Xcode keyboard shortcuts

  • To switch between the .h / .m files or counterparts of a class using Xcode
    ctrl++
  • To toggle the navigator pane of Xcode
    +0
  • To show the assistant editor +option+enter
  • To hide the assistant editor +enter
  • To highlight / show the current file open in editor via the navigator pane +shift+j
  • To toggle the utilities pane +option+0
  • To launch the open quickly input +shift+o