Reputation:
I have taken an Imageview class and iam adding image into that with code: TileImageView *tileImageView = [[Tile alloc] initWithImage:tileImage];
and adding into view like this:[self.view insertSubview:tileImageView atIndex:0];
So how to remove the Imageview class and alloc new image to that view
Upvotes: 0
Views: 79
Reputation: 171734
There's a tag property in the UIView class which you can use to retrieve the view later.
titleImageView.tag = 1;
[self.view addSubview:titleImageView];
// later:
titleImageView = [self.view viewWithTag:1];
titleImage.view.image = otherImage;
Or you can save the reference to the image view in an instance variable.
Upvotes: 2