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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:53:43+00:00 2026-06-01T22:53:43+00:00

I have a gradient image that’s blue in color. it’s 100px (height) x 1px

  • 0

I have a gradient image that’s blue in color. it’s 100px (height) x 1px (width). Now I’m trying to use it as the background image for the highlighted state. But somehow, it turns into orange color at run time. What might be wrong here? The height of the button is 40px, so I am doing a resize before setting it

UIImage *image = [UIImage imageNamed:@"pressed.png"];
UIImage *stretchedImage = [[UIImage imageWithImage:image scaledToSize:frame.size] stretchableImageWithLeftCapWidth:0 topCapHeight:0];
[button setBackgroundImage:stretchedImage forState:UIControlStateHighlighted];
  • 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-01T22:53:45+00:00Added an answer on June 1, 2026 at 10:53 pm

    There’s a few possible explanations, in roughly descending order of likelihood:

    1) Your scaledToSize category code has a bug in it where it’s reversing the RGB order of the bytes in the image, changing blue to orange. Try not scaling the image and see if it’s the correct color. You don’t actually need to scale it anyway, button background images are already stretched to fit at runtime.

    2) You have two pressed.png images in your project, probably in different folders so you haven’t noticed, but since the compiler dumps all the images into the same folder at build time, your blue pressed.png is being overridden by an orange pressed.png. Search your project on disk to see if this is the case.

    3) You previously had an orange image called pressed.png and when you build the app it’s using the old image due to some caching issue. Try a clean build, reset your simulator and delete the app off the device.

    4) You have an pressed@2x.png version of the image that is orange. When you run on the device it’s using the retina version, so it looks different.

    5) Your PNG s corrupt somehow – delete it and re-create from scratch. I’ve had issues ebfore with images that are only 1px wide, so try making it wider if that’s the case.

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

Sidebar

Related Questions

I want to have a 1024px width website with a gradient background image. I
If I have css gradient code that looks like this: background-image: radial-gradient(circle farthest-side at
I currently have a simple color picker that loads in a color gradient image
I have created a css gradient.Am trying to place a image above that.Below is
I have a DataGrid that needs to show a gradient background on mouseover of
i want to have the gradient as background image like this how can i
I have a gradient background that I'm using like follows in an ASP.Net Webforms
I have a CSS gradient that runs the height of the page: html {
Thanks in advance. I'm trying to have a gradient image on the top of
I have the following CSS code. body{ height: 100%; min-height: 100%; max-height: 100%; background-color:

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.