我在splitview应用程序的DetailView.m中使用此代码。现在只有当设备旋转时才会发生方向更改。检测不会在应用程序启动时发生。我也得到这样的警告ipad SplitView方向详细查看
警告:“RootViewController的”可不回应“-adjustViewsForOrientation:”
什么变化,我需要做时,应用程序启动的应用程序调整方向代码。
> - (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
> duration:(NSTimeInterval)duration {
> [self adjustViewsForOrientation:toInterfaceOrientation];
> }
>
> - (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation
> {
> if (orientation == UIInterfaceOrientationLandscapeLeft ||
> orientation ==
> UIInterfaceOrientationLandscapeRight)
> {
> detailDescriptionLabel.center = CGPointMake(235.0f, 42.0f);
> bigthumbImageView.center = CGPointMake(355.0f, 70.0f);
>
> }
> else if (orientation == UIInterfaceOrientationPortrait ||
> orientation ==
> UIInterfaceOrientationPortraitUpsideDown)
> {
> detailDescriptionLabel.center = CGPointMake(160.0f, 52.0f);
> bigthumbImageView.center = CGPointMake(275.0f, 80.0f);
>
> } }
虽然pheelicks的回答取消了警告,但这样做还是有效的。谢谢 – nishantcm 2010-05-14 10:29:23