//1. 創建popVC
UIViewController*contentVC = [[UIViewControlleralloc]init];
contentVC.view.backgroundColor= [UIColorredColor];
//2. 設置popVC的尺寸
contentVC.preferredContentSize=CGSizeMake(300,300);
//3. 設置popVC為popOver
contentVC.modalPresentationStyle=UIModalPresentationPopover;
//4. 設置箭頭方向
contentVC.popoverPresentationController.permittedArrowDirections=UIPopoverArrowDirectionUp;
//5. 設置參考系
contentVC.popoverPresentationController.sourceView=self.view;
//6. 設置箭頭指向的對象
contentVC.popoverPresentationController.sourceRect=self.btn.frame;
//7. 展現popVC
[selfpresentViewController:contentVCanimated:YEScompletion:NULL];