UIBarButtonItem
未在 iOS 5.1 iPad 1 上显示,但适用于 iPad 4 上的 iOS 6。
_itemForImport = [[UIBarButtonItem alloc] initWithTitle:LS(@"Library", @"") style:UIBarButtonItemStyleBordered target:self action:@selector(itemForImportTouched)];
+ (void) presentInPopoverFromBarButtonItem:(UIBarButtonItem *)item withSourceType:(NSString*)sourceType {
UIPopoverController* popover = [IPadFilesViewController getPopoverController];
if (popover)
return;
IPadImagePickerController* pickerController = [[IPadImagePickerController alloc] initWithSourceType:sourceType];
popover = [[UIPopoverController alloc] initWithContentViewController:pickerController];
popover.delegate = pickerController;
[IPadFilesViewController setPopoverController:popover];
[popover presentPopoverFromBarButtonItem:item permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}