这个问题很简单,不废话,直接上代码
- (void)filterButtonAction:(UIButton *)sender
{
SHSearchViewController *searchVC = nil;
searchVC = [[SHSearchViewController alloc] initWithHotWordModel:self.hotwordModel];
searchVC.preferredContentSize = CGSizeMake(300, 300);
searchVC.modalPresentationStyle = UIModalPresentationPopover;
searchVC.popoverPresentationController.sourceView = sender;
searchVC.popoverPresentationController.sourceRect = sender.bounds;
searchVC.popoverPresentationController.passthroughViews = @[self.searchBar];
searchVC.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
searchVC.popoverPresentationController.delegate = self;
[self presentViewController:searchVC animated:true completion:nil];
}
实现代理
-(UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller
{
return UIModalPresentationNone;
}
网友评论