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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:48:04+00:00 2026-06-18T07:48:04+00:00

I thought it was possible, since UIImageView does this just fine. Can I draw

  • 0

I thought it was possible, since UIImageView does this just fine. Can I draw a UIImage in UIView’s drawRect: method in a way that I center the image horizontally, and the sides of the UIImage are then stretched to fill the reminder of the UIView?

- (void)drawRect:(CGRect)rect {
    [[[UIImage imageNamed:@"image"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 2, 0, 2)] drawInRect:rect];
}

The whole image keeps stretching. For example, the image is 100 pixels wide. 90 of the pixels in the center cannot be stretched, but both sides have 5 pixels I would like to stretch on both sides to the egde of the rect.

  • 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-18T07:48:05+00:00Added an answer on June 18, 2026 at 7:48 am

    That’s not how resizableImageWithCapInsets: works, I’m afraid.
    It’s designed to keep the edges un-stretched and to tile the middle bit to fill the remaining space.

    To achieve what I think you want, you will probably have to draw three images side-by-side.

    Hope that helps.

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

Sidebar

Related Questions

Not sure if this is even possible but since Verizon does not have an
Possible Duplicate: Java: Global Exception Handler I thought of something like this: public static
I don't think this is possible but I thought I'd throw it out there.
I don't even know if this is even possible, but I thought I'd ask.
I suppose this isn't a huge deal, since there are other way around this
I'm interested in Peer-to-Peer connections in the browser. Since this seems to be possible
EDIT: Clarifying. fout is is a FILE*. (I thought this was irrelevant since that
Possible Duplicate: Does anyone beside me just NOT get ASP.NET MVC? I dont know
Not sure if this is possible in Iphone sdk since i have not been
This is probably not possible, since I already checked the list of all GHC

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.