0

When I add picture to the ImageView in IB - its OK! But when I add picture in code, ImageView flattens a picture and It starts to look ugly.

Here is my code:

- (void)viewDidLoad
{

    [super viewDidLoad];
    if([self.navigationItem.title isEqualToString:@"Cup"]) 
    {
        [mainImage setImage:[UIImage imageNamed:@"cup2"]];
    }
    [self.view addSubview:giftImage];
}

Why this happens? Thanks!

Cosinus
  • 109
  • 1
  • 1
  • 7

1 Answers1

0

According to UIImageView Class Reference, you should call sizeToFit after adding a picture.

Chen-Hai Teng
  • 718
  • 6
  • 16