我有一个应用程序需要在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
。任何人都可以帮忙找出我出错的地方吗?