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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:27:04+00:00 2026-06-15T14:27:04+00:00

I have a simple project where I have a image that needs to be

  • 0

I have a simple project where I have a image that needs to be put into a viewcontroller and then added to the main view. The code works fine, but even though the content mode has been set UIViewContentModeScaleAspectFit , I don’t see the image scaled correctly. It appears stretched and clipped.
What am I doing wrong here?

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIViewController *controller = [[UIViewController alloc] init];
    UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a.jpg"]];
    imgView.contentMode = UIViewContentModeScaleAspectFit;
    [controller.view addSubview:imgView];
    [self.view addSubview:controller.view];
}
  • 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-15T14:27:06+00:00Added an answer on June 15, 2026 at 2:27 pm

    Solved the problm by creating a view using storyboard, linking it via IBOutlets and then loading the image. For whatever reason, assigning the imageview in the above mentioned way does not change its properties once set.

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

Sidebar

Related Questions

I have a very simple Setup project that copies three dlls into the GAC.
I have a simple Scala project that runs without any problems inside Eclipse, however,
Currently I have a simple maven project that is building a jar file and
In my simple project I have 2 views - a line item view (Brand)
I have created a very simple GUI project in Qt as follows: main: #include
We have a simple CCTV system in our office that shows a live image
I have a simple program that needs to display images. I know how to
I have an Android project that displays results, using a simple listview. What I
I'd like to try out the D programming language. I have simple pet project
I have this simple test project just to test the IncludeExceptionDetailInFaults behavior. public class

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.