0

enter image description here

I would like to add an UIImageView to this view. Can anyone help me please?

The problem is the compatibilities for 4/3.5 inch

I tryed this

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, self.view.bounds.size.height)];
[imageView setImage:[UIImage imageNamed:@"test.png"]];
[self.view addSubview:imageView];

but the image comes out of the screen!

Thank you!

4

1 回答 1

1

控制器使用默认大小创建并在viewDidLoad. 根据您创建图像视图的位置,它可能会给您带来问题

添加此代码:

imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

还要确保您没有其他不想让图像越过的视图,例如底部工具栏

于 2012-12-27T18:01:33.087 回答