I have multiple UIViews, UIButtons etc. and would like to execute some specific code for each when i first use them.
For example for my UIButton *title, when i call title.frame for the first time, i would like first to call a setter that will verify that my button isn’t nill and if it is then alloc and init my button, set my title to @”TITLE” etc.
How can i do this ?
I am guessing you are talking about lazy initialization but that will require you to use the accessor method
self.title.frameinstead oftitle.frame. You can implement the getter method like this.