Brion VIBBER has submitted this change and it was merged. Change subject: Consistent nav button and text shadows between iOS 6 and 7. ......................................................................
Consistent nav button and text shadows between iOS 6 and 7. Further centralization of nav and button styling code. Change-Id: Id97cf9225e2604a2e8e2245ba76212c369053f26 --- M Commons-iOS/AppDelegate.m M Commons-iOS/GalleryMultiSelectCollectionVC.m M Commons-iOS/ImageListCell.m M Commons-iOS/MyUploadsViewController.m 4 files changed, 33 insertions(+), 50 deletions(-) Approvals: Brion VIBBER: Verified; Looks good to me, approved diff --git a/Commons-iOS/AppDelegate.m b/Commons-iOS/AppDelegate.m index 36fb5a3..b51b9e0 100644 --- a/Commons-iOS/AppDelegate.m +++ b/Commons-iOS/AppDelegate.m @@ -102,6 +102,31 @@ [[UITextField appearance] setTintColor:[UIColor colorWithRed:0.00 green:0.49 blue:0.93 alpha:1.0]]; [[UITextView appearance] setTintColor:[UIColor colorWithRed:0.00 green:0.49 blue:0.93 alpha:1.0]]; } + + // Further tweaks for ensuring iOS 6 buttons look more iOS 7ish. Ok for these to happen in both + // versions for consistency. + [[UIBarButtonItem appearance] setTitleTextAttributes: + @{ + UITextAttributeFont: [UIFont boldSystemFontOfSize:16], + UITextAttributeTextColor: [UIColor whiteColor], + UITextAttributeTextShadowColor: [UIColor clearColor], + } + forState:UIControlStateNormal]; + + [[UIButton appearance] setTitleShadowColor:[UIColor clearColor] forState:UIControlStateNormal]; + + [[UIBarButtonItem appearance] setBackgroundImage:[UIImage imageNamed:@"clear.png"] + forState:UIControlStateNormal + barMetrics:UIBarMetricsDefault]; + + [[UINavigationBar appearance] setTitleTextAttributes: + @{ + UITextAttributeFont: [UIFont boldSystemFontOfSize:20], + UITextAttributeTextColor: [UIColor whiteColor], + UITextAttributeTextShadowColor: [UIColor clearColor], + UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, -1)] + } + ]; } -(void)preiOS7GlobalNavBarStyleOverrides @@ -110,31 +135,9 @@ // under "User Defined Runtime Attributes" //[[UINavigationBar appearance] setTranslucent:YES]; //[[UINavigationBar appearance] setOpaque:YES]; - [[UINavigationBar appearance] setTintColor:[UIColor clearColor]]; [[UINavigationBar appearance] setBackgroundColor:[UIColor colorWithWhite:0.0f alpha:0.3f]]; - - CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); - UIGraphicsBeginImageContext(rect.size); - CGContextRef context = UIGraphicsGetCurrentContext(); - - CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]); - CGContextFillRect(context, rect); - - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - [[UINavigationBar appearance] setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; - - // Sets the nav bar text color - also sets the color of any nav bar navigation item prompt text. - // (needed because by default the prompt text is very gray and hard to see) - [[UINavigationBar appearance] setTitleTextAttributes: - @{ - UITextAttributeTextColor: [UIColor whiteColor], - UITextAttributeTextShadowColor: [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3f], - UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, -1)] - } - ]; + [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"clear.png"] forBarMetrics:UIBarMetricsDefault]; } - (void)receivedUINavigationControllerDidShowViewControllerNotification:(NSNotification *)notification { diff --git a/Commons-iOS/GalleryMultiSelectCollectionVC.m b/Commons-iOS/GalleryMultiSelectCollectionVC.m index 385acea..e067ca3 100644 --- a/Commons-iOS/GalleryMultiSelectCollectionVC.m +++ b/Commons-iOS/GalleryMultiSelectCollectionVC.m @@ -168,13 +168,6 @@ style:UIBarButtonItemStyleDone target:self action:@selector(dismiss)]; - [rightButton setTitleTextAttributes:@{ - UITextAttributeFont: [UIFont boldSystemFontOfSize:16] - } forState:UIControlStateNormal]; - - // Remove the outline around the button to make iOS button look more iOS 7ish - [rightButton setBackgroundImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; - UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:[MWMessage forKey:@"gallery-album-title"].text]; item.rightBarButtonItem = rightButton; [navBar_ pushNavigationItem:item animated:NO]; diff --git a/Commons-iOS/ImageListCell.m b/Commons-iOS/ImageListCell.m index e9c4b42..102b0b6 100644 --- a/Commons-iOS/ImageListCell.m +++ b/Commons-iOS/ImageListCell.m @@ -115,10 +115,12 @@ NSRange fileNameRange = [title rangeOfString:fileName]; NSRange wholeRange = NSMakeRange(0, title.length); + /* NSShadow *shadow = [[NSShadow alloc] init]; [shadow setShadowColor: [UIColor colorWithWhite:0.0f alpha:1.0f]]; [shadow setShadowOffset:CGSizeMake (1.0, 1.0)]; [shadow setShadowBlurRadius:0]; + */ [attStr beginEditing]; [attStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:wholeRange]; @@ -127,7 +129,7 @@ [attStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:12.0f] range:wholeRange]; [attStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14.0f] range:fileNameRange]; [attStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:wholeRange]; - [attStr addAttribute:NSShadowAttributeName value:shadow range:wholeRange]; + //[attStr addAttribute:NSShadowAttributeName value:shadow range:wholeRange]; [attStr endEditing]; return attStr; diff --git a/Commons-iOS/MyUploadsViewController.m b/Commons-iOS/MyUploadsViewController.m index 9a24b4e..003530c 100644 --- a/Commons-iOS/MyUploadsViewController.m +++ b/Commons-iOS/MyUploadsViewController.m @@ -395,30 +395,15 @@ target:self action:@selector(uploadButtonPushed:)]; } - - [_uploadButton setTitleTextAttributes:@{ - UITextAttributeFont: [UIFont boldSystemFontOfSize:16] - } forState:UIControlStateNormal]; - - [_uploadButton setBackgroundImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; return _uploadButton; } - (UIBarButtonItem *)cancelButton { - - UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" - style:UIBarButtonItemStylePlain - target:self - action:@selector(cancelButtonPushed:)]; - - [btn setTitleTextAttributes:@{ - UITextAttributeFont: [UIFont boldSystemFontOfSize:16] - } forState:UIControlStateNormal]; - - [btn setBackgroundImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; - - return btn; + return [[UIBarButtonItem alloc] initWithTitle:@"Cancel" + style:UIBarButtonItemStylePlain + target:self + action:@selector(cancelButtonPushed:)]; } #pragma mark - Interface Actions -- To view, visit https://gerrit.wikimedia.org/r/89030 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id97cf9225e2604a2e8e2245ba76212c369053f26 Gerrit-PatchSet: 1 Gerrit-Project: apps/ios/commons Gerrit-Branch: master Gerrit-Owner: Mhurd <mh...@wikimedia.org> Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits