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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:13:57+00:00 2026-06-19T04:13:57+00:00

I am adding the uiimageview to the button in a way that : uiimageview

  • 0

I am adding the uiimageview to the button in a way that :

  1. uiimageview is center along the y-axis ( just edited again )
  2. the trailing space of uiimageview is always 10 points from button

and for this purpose, I am doing like the following

 // Just added these lines 
    UIImage *img                =   [UIImage imageNamed:@"reload.png"];
    indicator                   =   [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, img.size.width, img.size.width)];
    indicator.image             =   img;

    [self.logInButton addConstraints:[NSLayoutConstraint constraintsWithVisualFormat: @"H:|[indicator]-(10)-|"
                                                                                 options:0
                                                                                 metrics:nil
                                                                                   views:NSDictionaryOfVariableBindings(indicator)]];

    [self.logInButton addConstraint:[NSLayoutConstraint constraintWithItem:self.logInButton
                                                              attribute:NSLayoutAttributeCenterY
                                                              relatedBy:NSLayoutRelationEqual
                                                                 toItem:indicator
                                                              attribute:NSLayoutAttributeCenterY
                                                             multiplier:1.0
                                                               constant:0]];

However, what I am getting is that uiimageview is stretching out like below

enter image description here

Does anyone have any ideas about this. All comments are appreciated at here.

  • 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-19T04:13:58+00:00Added an answer on June 19, 2026 at 4:13 am

    Your constraint is saying that the image view should be flush with the left edge and 10 points from the right, so the image will stretch if the button is larger than the size of the image. You either need to center it in the x direction (and eliminate the one to the right side) or set a specific size for the image view.

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

Sidebar

Related Questions

I have an UIView. Over that Iam adding an UIImageView as subview. I want
I'm just adding a quick intro screen with a button, which compiles and displays
I have a Background view (UIImageView) in that i am adding a view(UIView). this
I am adding uiimageview as a subview to tabbarcontroller.view. when i pushed to other
I am adding Uiimageview as a subview to tabbarcontroller.view. when i pushed to other
I'm having trouble adding an image in xCode 4.2. When I'm inserting an UIimageview
I'm having a memory problem related to UIImageView. After adding this view to my
I have an app that displays 9 UIImageViews, and I'm adding in the ability
Adding the row one by one in the button click.. (i tried but its
OK, I get the concept of adding a UIImageView as soon as the app

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.