Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6134877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:24:39+00:00 2026-05-23T17:24:39+00:00

I am working with iPhone app(LandscapeRight Mode), I have added a Image view named

  • 0

I am working with iPhone app(LandscapeRight Mode), I have added a Image view named imageView on my first page, but I have to delete it again on Third and fourth page. Please remember that I have to add this image again on Fifth page.

I added image with following code on first page :

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_logo_medium.png"]];
imageView.frame = CGRectMake(123, 200, 250, 66);
imageView.tag = 800;
imageView.transform = CGAffineTransformMakeRotation(M_PI / 2);
//imageView.window.
[self.parentViewController.view.window addSubview:imageView];
[imageView release];

How this can be removed and re-added ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:24:40+00:00Added an answer on May 23, 2026 at 5:24 pm

    When you want to remove imageView from its superview call:

    [imageView removeFromSuperview];
    

    keep in mind that imageView receives a release when removed, so you need to ensure that it is properly retained if you plan to reuse it. In other words, you will need to add an ivar to your controller class where you can retain the imageView for reuse. Actually you assign it to a local variable and at the end of the method you release; the variable should not be local, but a controller’s ivar so to have persistence, and you will need to release it in your controller’s dealloc.

    EDIT:

    I suppose that you have a UIViewController somewhere that can manage adding and removing subviews as you need it.

    In this class (I don’t know how to call it because you did not say it), I would declare a member to store the subview:

    @interface MyViewController {
        ...
        UIImageView* imageView;
        ...
    }
    ....
    @end
    

    Here the implementation:

    @implementation MyViewController;
    ...
    
    -(void)viewDidLoad {
        [super viewDidLoad];
        ....
        [self createImageView];
        ....
    }
    
    - (void) createImageView {
      imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_logo_medium.png"]];
      imageView.frame = CGRectMake(123, 200, 250, 66);
      imageView.tag = 800;
      imageView.transform = CGAffineTransformMakeRotation(M_PI / 2);
    }
    
    - (void)addImageView {
        [self.parentViewController.view.window addSubview:imageView];
    }
    
    - (void) removeImageView {
       [imageView removeFromSuperview];
    }
    
    -(void)dealloc {
        ...
        [imageView release];
        ...
    }
    

    So, in viewDidLoad you create the imageView and store it internally for later use; When you need it, you add it by calling addImageView; when you are done with it, you remove it with removeImageView.

    If your class is not a view controller, you should be able to apply those same changes to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on iPhone app. I have added Navigation bar Background image With
i'm working on iphone app which will show 4 buttons in first view. on
I am working on an iPhone app but found that I require another view
I am working on iPhone app and I have an openGL view rendering on
I'm working on a simple iPhone app. I have 1 UINavigationController and 2 subclasses
I'm working on a very simple iPhone app, that in the end will have
I'm working on an iphone app but this is probably a general question. I
I am working on an iPhone app using a SQLite db. I have some
Greetings! I have a working iPhone app (huzzah!) that uses a MainView.xib containing a
I am working on an iphone app in IOS5 that user storyboards. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.