Iphone 即使在实现shouldAutorotateToInterfaceOrientation之后,视图也不会调整大小

Iphone 即使在实现shouldAutorotateToInterfaceOrientation之后,视图也不会调整大小,iphone,ios,ios4,ios5,Iphone,Ios,Ios4,Ios5,对于我的代码, shouldAutorotateToInterfaceOrientation被调用,我在那里返回YES,但当我旋转设备时,控制器的视图会更改其大小,但主视图中的UIImageView不会更改其大小。我希望它能像主视图一样调整大小 提前感谢根据需要设置autoresizingMask=uiviewautoresizingflexiblewhight | UIViewAutoresizingFlexibleWidth。 在代码中 imageview = [[UIImageView a

对于我的代码, shouldAutorotateToInterfaceOrientation被调用,我在那里返回YES,但当我旋转设备时,控制器的视图会更改其大小,但主视图中的UIImageView不会更改其大小。我希望它能像主视图一样调整大小


提前感谢

根据需要设置
autoresizingMask=uiviewautoresizingflexiblewhight | UIViewAutoresizingFlexibleWidth

在代码中

imageview = [[UIImageView alloc] initWithFrame:CGRectMake(40,40,120,100)];
imageview.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin;

如果已在xib中创建,则在IB集合中创建,如下图所示

您是在IB中还是在code?中从code.创建的。。imageview=[[UIImageView alloc]initWithFrame:CGRectMake(40,40120100)];非常感谢。我在代码“autoresizingMask”中添加了这行代码,它正在工作。。。!!