2013-04-15 47 views
0

我添加了一個通知的視圖,我加入類的代碼如下所示的應用程序委託文件敬酒,窗口在應用程序委託方向不工作

customView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 54)] autorelease]; 
[customView setBackgroundColor: UIColorFromRGB(0xda5340)]; 
UILabel *lb1=[[[UILabel alloc]initWithFrame:CGRectMake(10, 17, 180, 21)] autorelease]; 
[email protected]"Pet is out of boundary"; 
lb1.textAlignment = UITextAlignmentCenter; 
lb1.textColor=[UIColor whiteColor]; 
lb1.backgroundColor = [UIColor clearColor]; 
[customView addSubview:lb1]; 
[self.window addSubview:customView]; 
[self.window showToast:customView duration:3.0 position:@"top" ]; 

我已經把我的iPad的iPad應用程序,景觀,以上代碼正常工作只與iPhone,當我嘗試在iPad不正確的方向,customView被視爲垂直。我已經添加了下面的代碼也

-(BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation { 
return YES; 
} 

-(NSUInteger)supportedInterfaceOrientations{ 
    return UIInterfaceOrientationMaskAll; 
} 

如果我想添加任何其他代碼,請幫我解決

回答

0

爲主導方向的最簡單的初始設置是選擇summary選項卡,然後選擇喜歡的方向如下圖片,

enter image description here

enter image description here

+0

我所做的,即使它不是w ^工作會有 – fazil