UIViewController removes subview

I add the view as a subpoint of my uiviewcontroller as follows:

// into my ViewController:
UIImageView *imView =[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"img.jpg"]];
imView.frame = CGRectMake(2, 46, 1020, 720);
[self.view addSubview:imView];

now, with another button, I want to remove imView from the subview chain. How can i do this? thank

+3
source share
1 answer

You can call this method, which belongs to UIView (and UIImageView inherits from UIView)

UIView - (void) removeFromSuperview

+5
source

Source: https://habr.com/ru/post/1749735/


All Articles