Search code examples
iphoneviewdidloadautoresizingmask

Mistake in autoResizingMask


i have implemented a small viewDidLoad() to show an Picture with autoresizing, but it doesn't work, could please someone help me and say what is the mistake in this code in line 3 and 4????

imageView = [[UIImageView alloc] initWithImage:img];
    imageView.frame = self.view.frame;
    imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
    imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

i hope someone could help me?


Solution

  • If im not mistaken you should do it the following way:

    imageView.autoresizingMask = ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight );
    

    The way you do it, you override the autoresizingMask.