Nik's
Nik's

Reputation: 690

what is use of self in 'self.window addSubview : view '?

i am new developer of iphone i want to knw what is the difference b/w these 2 statement statement1:

[self.window addSubview:lscreen.view];

statement2:

[window addSubview:lscreen.view];

Upvotes: 3

Views: 626

Answers (2)

Nik's
Nik's

Reputation: 690

self key word is used when we useing the property getter/setter instead of accessing the value directly. when it is generated by the synthesize key word you have to use self because the object is retained there instead of simply pointer-assigned.

Upvotes: 0

PJR
PJR

Reputation: 13180

This document help you to understand self in any objective c code.

http://useyourloaf.com/blog/2011/2/8/understanding-your-objective-c-self.html

Upvotes: 1

Related Questions