我在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