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 7440177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:48:44+00:00 2026-05-29T10:48:44+00:00

I have an application where I initially set a UIButton’s background image, and then

  • 0

I have an application where I initially set a UIButton’s background image, and then need to change it to something else later. I do realize I could just remove the original button and allocate a new button with the new image, but I’d prefer to be more efficient and reuse the object that I’ve already allocated. Is is possible to do this? I noticed that the currentBackgroundImage property is readonly, so when I try stuff like:

        [thumbnailButton setBackgroundImage:nil forState:UIControlStateNormal];
        [thumbnailButton setBackgroundImage:[UIImage imageWithCGImage:[[photos objectAtIndex: currentPhotoIndex] thumbnail]] forState:UIControlStateNormal];

or just:

        [thumbnailButton setBackgroundImage:[UIImage imageWithCGImage:[[photos objectAtIndex: currentPhotoIndex] thumbnail]] forState:UIControlStateNormal];

I get the following:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCellContentView setBackgroundImage:forState:]: unrecognized selector sent to instance 0x16c570'

Is it possible to accomplish using UIButton or do I just need delete the original button and create a new one?

  • 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-29T10:48:45+00:00Added an answer on May 29, 2026 at 10:48 am

    You have a memory management problem here.

    * Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[UITableViewCellContentView
    setBackgroundImage:forState:]: unrecognized selector sent to instance
    0x16c570’

    This means that your thumbnailButton is not pointing at a UIButton, but rather a UITableViewCellContentView. This could happen by improper assignment or if the UIButton is deallocated (in this case you have have a dangling pointer). Run the analyzer and double check your use of the button.

    UIButton buttonWithType returns an autoreleased instance, so you need to retain it.

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

Sidebar

Related Questions

I have a model in a Rails/Mongoid application that I had initially set a
I have a Silverlight application communicating with the server side through WCF services. Initially
I am thinking of making an (initially) small Web Application, which would eventually have
I have an MDI application that initially doesn't have the main window open. When
We have an application which uses SQLite as an embedded RDBMS. Initially the application
Ok, so I have an application that reads another processes memory. I initially had
I'm working on an HTML5 mobile app and I initially have the background of
My UIWindow initially has a white background. I want to change the background to
I have a scientific application for which I want to input initial values at
I have application which needs to use a dll (also written by me) which

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.