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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:14:58+00:00 2026-05-27T12:14:58+00:00

I hava a UIButton. And for my button I want to set image with

  • 0

I hava a UIButton. And for my button I want to set image with vertical gradient.
enter image description here

Button can change it width and height, so I need to make image stretchable. I found method like:

UIImage* myGradientImage = [UIImage imageNamed:@"gradientImage.png"];
UIImage* stretchImage = [myGradientImage
    stretchableImageWithLeftCapWidth:20 topCapHeight:20];

When button width grows its stretched ok. But if height grows, gradient looks not very good.
enter image description here

Is there any possibility to set bottomCapHeight and topCapHeight together ? Or to say to image do not touch center of image ?

  • 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-27T12:14:58+00:00Added an answer on May 27, 2026 at 12:14 pm

    If you do

    UIImage* stretchImage = [myGradientImage stretchableImageWithLeftCapWidth:20 
                                                                 topCapHeight:0];
    

    The height will stretch uniformly, which will look fine if you give a high-res original image.

    If your rounded corners are in the image, however, this will make them non-circular. To get around that, supply your gradient image without rounded corners, then do

    button.layer.cornerRadius = 4;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hava a main view, where you have one object and you can change
i hava a set of following tables customer(cus_id,cus_name); jointAccount(cus_id,acc_number,relationship); account(acc_number,cus_id) now i want to
I hava set up AJAX script that when you click the button it calls
I hava a Rails application, I need to integrate Facebook. User can login with
I hava a CSV file that I want to treat as source code. Essentially
I am trying to upload an image to the server. I hava a form
I hava an ArrayList of String values (they need to be formatted as such)
I hava a JFrame with multiple JPanels of similar width aligned one below other.
I hava a basic Hibernate/JPA question. I want to find a best practice solution
I hava very large table with 1373228 rows. I need to copy the result

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.