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

  • SEARCH
  • Home
  • 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 8278951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:10:28+00:00 2026-06-08T09:10:28+00:00

After adding a background (image) to my UIView (View_0) I wish to implement a

  • 0

After adding a background (image) to my UIView (View_0) I wish to implement a button to remove the same background.

How can I do it? I have tried to set a different image as the background of View_0 but this does not work (I suspect this background is set behind “image”).

I don’t want to use

[View_0 removeFromSuperview];

as I need View_0 to still be there for other purposes….

//Create an ImageView
UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 940, 422)];;           

//Add the ImageView as the background of the View_0
[View_0 addSubview:image];
//Move custom image behind View
[View_0 sendSubviewToBack: image];

//Failed attempt to remove the background....
View_0.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"defaultImage.PNG"]];    
  • 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-06-08T09:10:30+00:00Added an answer on June 8, 2026 at 9:10 am

    You have added a UIImageView to the View and Not the background of the view. So what is happening is that when u implement

    View_0.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"defaultImage.PNG"]];
    

    The background of the View is being set but the UIImageView is now on top of the View so that is why the background of the View is not being shown.

    Instead if you simply want to add the background you can change it to the Action of the UIButton.

    Also if you use [View_0 removeFromSuperview]; you are trying to remove the view which is not right.

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

Sidebar

Related Questions

After adding elements to page using something like this, $('#blah').append('<div id=bugsbunny></div>'); how can I
I'm having a problem after adding button on my star rating. Every time when
I have to add istantly some items without reload the page. After adding these
Update After adding the following style and setting it for my application, I have
Fellow developers, I'm trying to set a web image as a background for a
I'm adding a UIView to the window while some threaded background updates are happening,
I want to place a background-image after end of div bottom for a shadow
After adding Restkit to the Podfile : platform :ios dependency 'Facebook-iOS-SDK', '1.2' dependency 'RestKit',
After adding a second persistence unit and changing my application's data sources to XADataSource
After adding the /TSAWARE linker flag to one of my projects (Visual Studio 6),

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.