1
點擊我有UIPopoverController問題。按下按鈕我需要顯示UIPopoverController。這是代碼。如何顯示UIPopoverController當按鈕在iPhone
-(IBAction)hintButton:(id)sender{
CGRect contentRect = CGRectMake(0, 0, 200, 40);
UIViewController* popoverContent = [[UIViewController alloc] init];
popoverContent.view = hintB;
popoverContent.contentSizeForViewInPopover = contentRect.size;
if(popoverController == nil){ //make sure popover isn't displayed more than once in the view
popoverController = [[UIPopoverController alloc]initWithContentViewController:popoverContent];
[popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
popoverController.delegate = self;
}
}
當我按下按鈕的應用程序崩潰。
而是一個UIViewController做UIPopoverController,看看是否有什麼差別。 –