我有這樣的代碼UIViewController
子類中:觀點是不正確的旋轉
- (id)init {
self = [super init];
if (self) {
self.view.frame = [PDToolbox screenFrame];
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.view.backgroundColor = [UIColor redColor];
}
return self;
}
我在的任何旋轉方法上的唯一事情是這樣的:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return YES;
}
但是屏幕後被旋轉到風景,在視圖上做一個NSLog顯示此:
<UIView: 0x10061640; frame = (0 0; 320 480); transform = [0, -1, 1, 0, 0, 0]; autoresize = W+H; layer = <CALayer: 0x10061670>>
我不明白爲什麼它正在做這個轉變的事情,而不是像正常一樣旋轉?這意味着我將任何視圖放置在旋轉後的頂部,並將視圖的大小設置爲320x480的位置。
編輯:
人們不理解。所以我把一個視圖在它上面,同樣大小的的UIView,使用:
UIView *anotherView = [UIView alloc] initWithFrame:controller.view.bounds];
[controller.view addSubview:anotherView];
如果我在肖像添加anotherView,anotherView出現在肖像,與框架小320x480。
如果我在景觀中添加另一個視圖,另一個視圖出現在橫向上,但仍與幀320x480,因爲這是controller.view的框架仍然是什麼,因爲某些未知的原因。
你可以只發布你的UIViewCOntroller的整個代碼 – 2012-07-12 16:30:53
@ R.A當然。剛做完了。 – Andrew 2012-07-12 16:36:13
其實我不明白你的問題..你是什麼意思?「我把它放在它的頂部,並將其設置爲視圖的大小最終在320x480的位置」 – 2012-07-12 16:40:56