2013-03-20 56 views
-4

正在創建通用應用程序。通用應用程序UI問題

在我的iPhone應用程序中:我創建了自定義屏幕以通知用戶關於後臺進度的進度。我添加視圖控制器使用segue,它佔據整個屏幕。

在我的iPad應用程序中:我正在使用調用顯示進度的ViewController的UIPopoverController。 但是,iPad也佔據了整個屏幕。我希望它只佔用UIPopoverController的屏幕。我不能理解我應該如何添加屏幕,以便它只會隱藏最後一個UIPopoverController。

回答

1

試試這個

- (IBAction)onShare:(id)sender 
{ 
UIButton *btn = (UIButton *)sender; 
SocialNetworkView *socialNetworkShare = [[SocialNetworkView alloc] initWithNibName:@"SocialNetworkView" bundle:nil]; 

socialNetworkShare.delegate=self; 
//---------------------------contentSizeForViewInPopover------------------ 
//set required size in contentSizeForViewInPopover in your view controller 
socialNetworkShare.contentSizeForViewInPopover =CGSizeMake(socialNetworkShare.view.frame.size.width, socialNetworkShare.view.frame.size.height); 


popSocialNetworkShare = [[UIPopoverController alloc] initWithContentViewController:socialNetworkShare]; 

[popSocialNetworkShare presentPopoverFromRect:btn.frame inView:self.view permittedArrowDirections:YES animated:YES]; 
} 
1

使用[UIPopoverController alloc] initWithContentViewController:創建彈出窗口並將您的視圖控制器傳遞到initWithContentViewController。此外,在您的視圖控制器中設置所需大小self.contentSizeForViewInPopover