Wednesday, June 9, 2010

Confusion with basic view class method.('atIndex')

Hell friends,
Today I will solve your confusion with view class methods.

The main confusion comes with following command.


[self.view insertSubview:aView atIndex:0];


In bove command the term atIndex , what does it show, it makes guys confused as heck.

the term atIndex is actually the indexing of the view hierarchy in your nib files.





While you write this line , it means 'aView' wil be inserted just above the view (the self.view) e.g if there were two labels label1 and label2 on the view in our nib, and if we had written this



[self.view insertSubview:aView atIndex:1];





Then 'aView' would have been between first label and second label .(think)

I hope you have got the concept down. If you need any help please comment.

1 comment:

Followers