Wednesday, September 11, 2013

Difference between Weak and Strong keywords

Strong means you want to keep control over the lifetime of the object. If an object is marked as strong mean object remains in the heap until you point that object strongly. If you send the object to nil only than it will be collected by the Garbage collection.

Weak means you don't want to keep control over the lifetime of the object. A weak reference does not extend the lifetime of the object it points to, and automatically becomes nil when there are no strong references to the object. If no one is pointing the object strongly than the object will be collected by the heap.


you can find more details about ARC(Automatic Reference Counting) Click Here...




Tuesday, September 10, 2013

What is "id" in Objective C

id

'id' is a typedef in objective C. This means "Pointer to an Object". This Object can be any object of Objective C.


typedef struct objc_class *Class;
typedef struct objc_object {
    Class isa;
} *id;


typedef struct objc_selector    *SEL;    
typedef id          (*IMP)(id, SEL, ...); 

Monday, September 9, 2013

Pointers in Objective C

Pointer?
A pointer references a location in the memory. In simple words it keeps the address of the memory where actual data is stored. Obtaining the content of the pointer is called deferencing the pointer.
Pointers to data significantly improve performance for repetitive operations such as traversing strings, lookup
tables, control tables and tree structures. In particular, it is often much cheaper in time and space to copy and dereference pointers than it is to copy and access the data to which the pointers point. you can learn more about pointers here.

Sunday, September 8, 2013

Introduction to Objective C

Learning any kind of language starts with learning basics of the programming language. If one needs to understand than I would say he must understand the basics keywords of C language like printf, unsignedint, const char, malloc, alloc, etc. It would be of great help if one can go through few chapters of c language before going into objective C.

If you are programming in Java, .Net or any other High Level Language, than I would say you better tighten your seat belts because once you will see the objective c in active you are gonna be on a roller coaster ride. The syntax, semantics, object oriented approach etc are implemented in a sophisticated way.