Skip to content

Instantly share code, notes, and snippets.

@hammadzz
Last active December 7, 2016 12:50
Show Gist options
  • Save hammadzz/02bdd2c0656529c371e0be1af521f248 to your computer and use it in GitHub Desktop.
Save hammadzz/02bdd2c0656529c371e0be1af521f248 to your computer and use it in GitHub Desktop.
//Put this line in application did finish launching
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor whiteColor]];
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
//Another option
//Also use this to prevent to Cancel button text on the popup to disappear
[activityController.view setTintColor:[UIColor redColor]];
//What is this
[[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
//THis works too
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];
activityViewController.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll, UIActivityTypeAddToReadingList, UIActivityTypePostToVimeo, UIActivityTypePostToFlickr, UIActivityTypeAirDrop];
[activityViewController setCompletionHandler:^(NSString *activityType, BOOL completed) {
// back to normal color
[[UINavigationBar appearance] setBarTintColor:AAColorInputBorder];
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"Avenir-Medium" size:18], NSFontAttributeName,
[UIColor whiteColor], NSForegroundColorAttributeName,
nil]];
}];
[self presentViewController:activityViewController animated:YES completion:^{
// change color temporary
[[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"Avenir-Medium" size:18], NSFontAttributeName,
AAColorInputBorder, NSForegroundColorAttributeName,
nil]];
[activityController setCompletionWithItemsHandler:^(NSString * __nullable activityType, BOOL completed, NSArray * __nullable returnedItems, NSError * __nullable activityError)
{
//Your Code goes here
// [[UIBarButtonItem appearance] setTintColor:[UIColor blackColor]];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment