搜索栏没有在模态演示视图控制器上显示?

时间:2016-12-19 07:30:12

标签: ios iphone ipad uipopovercontroller

我有一个应用程序需要在UITableView之上显示搜索栏。我正在提出这样的模态演示:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
searchViewController *formmodal1 = [storyboard instantiateViewControllerWithIdentifier:@"searchViewController"];

// UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:formmodal1];
// present the controller
// on iPad, this will be a Popover
// on iPhone, this will be an action sheet

formmodal1.modalPresentationStyle = UIModalPresentationPopover;

formmodal1.delegate=self;
UIPopoverPresentationController *popController = [formmodal1 popoverPresentationController];
popController.permittedArrowDirections = UIPopoverArrowDirectionUp;

popController.presentedViewController.preferredContentSize = CGSizeMake(350,350);
popController.sourceView = sender;
popController.sourceRect = btn.bounds;
formmodal1.popoverPresentationController.delegate = self;
[self presentViewController:formmodal1 animated:YES completion:nil];

在这里,我面临的问题是搜索栏没有显示。完整视图由UITableView接管。我在UIViewController的顶部位置添加了搜索栏,之后我添加了UITableView。任何人都可以帮忙找出我出错的地方吗?

0 个答案:

没有答案