Stefan
Stefan

Reputation: 13

How to access subviews in iOS6

I create dynamically subviews in my ViewController like this:

CGRect imageFrame = CGRectMake(0.0, 0.0, 1024.0, 748.0);
UIImageView *backgroundImage = [[UIImageView alloc] initWithImage:bgImage];
backgroundImage.frame = imageFrame;
[self.view addSubview:backgroundImage];

(Basically, I add various subviews to my view, which are containers for different types of content.)

I am looking for a proper way now, to access these subviews later on, for e.g. fade them out. Is there a way to add these subviews with an identifier, so I can call them directly ?

Upvotes: 1

Views: 86

Answers (1)

rocky
rocky

Reputation: 3541

What about UIView's tag property?

Upvotes: 1

Related Questions