Created
August 27, 2015 13:11
-
-
Save acalism/70d488733ad67a46c4ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { // iPad | |
if ([UIPopoverPresentationController class]) { // iOS8 | |
avc.modalPresentationStyle = UIModalPresentationPopover; | |
UIPopoverPresentationController *ppc = avc.popoverPresentationController; | |
//ppc.permittedArrowDirections = UIPopoverArrowDirectionAny; | |
ppc.barButtonItem = self.shareButtonItem; // self.toolbarItems.lastObject; | |
//ppc.sourceRect = self.navigationController.toolbar.frame; | |
//ppc.sourceView = self.navigationController.toolbar; | |
} else { | |
self.myPopoverController = [[UIPopoverController alloc] initWithContentViewController:avc]; | |
// self.myPopoverController.delegate = self; | |
[self.myPopoverController presentPopoverFromBarButtonItem:self.shareButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; | |
return; | |
} | |
} | |
[self presentViewController:avc animated:YES completion:nil]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
适配ipad,iOS8下用popoverPresentationController实现,iOS7下用UIPopoverController实现