For a Universal App, how do I set the UIImageView frame in the ViewController?
UIView *baseView = [[UIView alloc] init];
[self.view addSubview:baseView];
// Displays UIImageView
UIImageView *myImage = [[UIImageView alloc]
initWithImage:[UIImage imageNamed:@"tool.png"]];
[baseView addSubview:myImage];
When I run app it shows black screen. So i guess I have to set a frame for it.
You kinda answered your own question – yes you have to set a frame for it.
You may want to try:
You could also set the autoresizingmask for baseView and myImage so that as self.view’s frame changes, so do these two views.
Also, just in case you aren’t using ARC – don’t forget to autorelease these views before leaving this method.