UIViewController remove subview

12,688

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

UIView - (void)removeFromSuperview

Share:
12,688
ghiboz
Author by

ghiboz

c# programmer for work, php, objective-c, c++ programmer for passion

Updated on June 04, 2022

Comments

  • ghiboz
    ghiboz almost 2 years

    I add a view as subview of my uiviewcontroller like this:

    // 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 wish remove the imView from the subview chain.. how can I do to do this?? thanks