0
我試圖根據iPad的方向初始化我的UIViewController。 在initWithNibName,我使用下面的代碼:初始UIViewController取決於iPad的方向
CGSize size = self.view.frame.size;
authForm = [[[AuthForm alloc] initWithFrame:CGRectMake(-400,(size.height-400)/2,400,400)] autorelease];
[self.view addSubview:authForm];
這是當應用在人像模式(倒置與否)啓動我想要什麼,但我想有這樣的,當它啓動在橫向模式(左或右):
authForm = [[[AuthForm alloc] initWithFrame:CGRectMake((size.width-400)/2,-400,400,400)] autorelease];
我怎麼能這樣做呢? 我已經用willAutorotateToInterfaceOrientation:
試過幾件東西,但沒有奏效。
檢查http://stackoverflow.com/questions/2825696/switch-between-multiple-views-while-respecting-orientation –