I had an application in which I need to show a search bar on top of a UITableView
. I am presenting the modal presentation like this:
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];
Here I am facing an issue like the search bar is not showing. The full view is taken over by UITableView
. I am adding search bar on top position of the UIViewController
,and after that I am adding UITableView
bellow that. Can anybody help to find out where I am going wrong?