UIImageView:全屏图像

Ste*_*ino 0 iphone ios

我想在iPhone上看到全屏图像.我必须设置多少像素?iPhone 3和4的宽度和高度不同?

我的源代码:

NSString *filePath = [[NSBundle mainBundle] pathForResource:theProduct.image ofType:@"png"]; 
UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:filePath]];
img.frame = CGRectMake(0.0, 0.0, ?, ?);
[self.view addSubview:img];
Run Code Online (Sandbox Code Playgroud)

我该怎么做而不是问号?

非常感谢,斯特凡诺

Mar*_*ams 8

尝试将UIImageView的框架设置为[[UIScreen mainScreen] applicationFrame].

这将设置UIImageView使用应用程序可用的所有空间,如果状态栏可见,则不包括状态栏.