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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:39:24+00:00 2026-05-11T03:39:24+00:00

Are there any reasons why the simulator will display UIImageViews properly, but incorrectly on

  • 0

Are there any reasons why the simulator will display UIImageViews properly, but incorrectly on the iPhone?

My Process: An image in a PNG file Start a UIGraphicsBeginImageContext() Draw the PNG in a CGrect Draw text in the CGRect Create an UIImage from the context Set the image of a UIImaveView to the UIImage Set the frame of the UIImageView to the size of the PNG Add as a subview

Outcome: The image does not display correctly. The rightmost 1-3 pixels of the image is just a vertical white line. This occurs only on the device and not on the simulator. I can fix the problem, but only by increasing the size of the UIImageView. If I increase the size.height of the UIImageView by 1 pixel, it displays the UIImage correctly. Of course, these leaves the iPhone to scale my image before drawing it on screen which is not desirable.

Any ideas why this occurs or any fixes for it? (I will post my code if needed)

  • 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. 2026-05-11T03:39:25+00:00Added an answer on May 11, 2026 at 3:39 am

    Got IT!

    Here is how I beat the SDK.

    For some reason, A UIImageView does not like the image produced by the UIGraphicsBeginImageContext. So instead, I changed my class as a subclass of a standard UIView (not UIImageView). Then I implemented the drawRect method. Inside the drawRect method, i put the same code I had in the UIGraphicsBeginImageContext block.

    For some reason, this code renders the image properly in the drawRect method, but not in the UIGraphicsBeginImageContext(may be a bug, may be me).

    The code follows.

    - (void)drawRect:(CGRect)rect {       UIImage *backgroundImage = [UIImage imageNamed:imageFile];     CGRect elementSymbolRectangle = CGRectMake(0.0f ,0.0f, backgroundImage.size.width, backgroundImage.size.height);     [backgroundImage drawInRect:elementSymbolRectangle];      // draw the element name     [[UIColor whiteColor] set];      // draw the element number     UIFont *font = [UIFont boldSystemFontOfSize:(smallFontSize)];     CGPoint point = CGPointMake(2,1);     [self.atomicNumber drawAtPoint:point withFont:font];      // draw the element symbol      font = [UIFont boldSystemFontOfSize:largeFontSize];     CGSize stringSize = [self.symbol sizeWithFont:font];     point = CGPointMake((elementSymbolRectangle.size.width-stringSize.width)/2,self.frame.size.height-(largeFontSize)-(largeFontSize/10));     [self.symbol drawAtPoint:point withFont:font];  } 

    (Also, this code can be found in the Apple Sample Code: theElements)

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

Sidebar

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You need to install this provider. The Visual Studio Team… May 11, 2026 at 12:45 pm
  • added an answer Maybe this ugly hack: Map<String, Integer> keyTextToCode = new HashMap<String,… May 11, 2026 at 12:45 pm
  • added an answer You can send XMLHttpRequests only to your domain. if your… May 11, 2026 at 12:45 pm

Related Questions

I know it is customary, but why? Are there real technical reasons why any
I read this answer and its comments and I'm curious: Are there any reasons
Are there any good reasons not to use \u0000 as a delimiter within a
Are there any microscopic reasons at all (beyond superstition), to add an extra return
I have heard of desktop applications whose code has been open-sourced, but are there
I have a C++ library that provides various classes for managing data. I have
I have a String which I would like to modify in some way. For
Are there any common reasons why upgrading a database from SQL Server 2000 to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.