Last active
December 17, 2015 20:49
-
-
Save ddeville/5670475 to your computer and use it in GitHub Desktop.
Caution: this is very very nasty...
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
@interface SomeViewController : UIViewController | |
@end | |
@implementation SomeViewController | |
- (IBAction)show:(id)sender | |
{ | |
UIImagePickerController *pickerController = [UIImagePickerController new]; | |
[pickerController setDelegate:(id)self]; | |
[self presentViewController:pickerController animated:YES completion:nil]; | |
} | |
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated | |
{ | |
if ([viewController isKindOfClass:NSClassFromString(@"PLUIAlbumViewController")]) { | |
/* | |
The custom view on the navigationItem is set up in loadView so the view | |
needs to be loaded. | |
*/ | |
(void)[viewController view]; | |
/* | |
At this stage, with the view loaded, if you do: | |
po [[viewController navigationItem] rightBarButtonItems] | |
you will indeed get nil. | |
But if you do: | |
po [[viewController navigationItem] _customRightViews] | |
you will get the UINavigationButton that is currently displayed. | |
*/ | |
[[[viewController navigationItem] valueForKey:@"_customRightViews"] enumerateObjectsUsingBlock:^ (UIView *view, NSUInteger idx, BOOL *stop) { | |
[view setHidden:YES]; | |
}]; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interesting hack. I contacted Apple about this. Citing Pages and they told me they used private APIs to do that. But they also said this was "in the past" and they only use public APIs now in their apps. Will be interesting to see if there's an update to the iWork iOS suite if this image picker changes.