I am adding the uiimageview to the button in a way that :
- uiimageview is center along the y-axis ( just edited again )
- 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

Does anyone have any ideas about this. All comments are appreciated at here.
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.