2012-02-13 77 views
0

強壯的文本我有一個iPad應用程序,它只允許橫向定位,並以橫向方向啓動。我有一個UIViewController並在viewDidLoad我設置視圖的幀:UIView框架在iPad應用程序中改變座標

self.view.frame = CGRectMake(0, 0, 1024, 728); 

touchesBegan函數在同一UIViewController我打印出來的視圖:

NSLog(@"%@",self.view); 

,當我點擊屏幕得到:

<UIView: 0x37e370; frame = (0 0; 768 1024); transform = [0, 1, -1, 0, 0, 0]; layer = <CALayer: 0x37e3d0>> 

正如你所看到的,邊框變爲[0,0,768,1024](這是縱向的iPad),而不是[0,0,1024,728](W這是我定義它在viewDidLoad方法)。

它爲什麼打開我?

回答

0

這與你的其他問題有關,不是嗎? iPad Landscape messing up touches began

引用您的答案: 「是,定義一個UIWindow時,需要將其定義爲

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 

,而不是嚴格的座標 。」