From 3d42089a8fac73ca2c437fdfffaffc12ac540159 Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Wed, 2 Jan 2013 13:00:13 +0000 Subject: [Author: thomasvl] Remove the GC support code. Add the needed images for the iOS unittests under iOS 6.0. Add a workspace file for the iPhone project. R=dmaclach DELTA=215 (85 added, 122 deleted, 8 changed) --- iPhone/GTMUILocalizer.m | 24 ++++++++++++++++++++-- iPhone/TestData/GTMFadeTruncatingLabelTest1.6.png | Bin 0 -> 2714 bytes iPhone/TestData/GTMFadeTruncatingLabelTest2.6.png | Bin 0 -> 1735 bytes iPhone/TestData/GTMFadeTruncatingLabelTest3.6.png | Bin 0 -> 3261 bytes iPhone/TestData/GTMFadeTruncatingLabelTest4.6.png | Bin 0 -> 2122 bytes iPhone/TestData/GTMFadeTruncatingLabelTest5.6.png | Bin 0 -> 2661 bytes 6 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 iPhone/TestData/GTMFadeTruncatingLabelTest1.6.png create mode 100644 iPhone/TestData/GTMFadeTruncatingLabelTest2.6.png create mode 100644 iPhone/TestData/GTMFadeTruncatingLabelTest3.6.png create mode 100644 iPhone/TestData/GTMFadeTruncatingLabelTest4.6.png create mode 100644 iPhone/TestData/GTMFadeTruncatingLabelTest5.6.png (limited to 'iPhone') diff --git a/iPhone/GTMUILocalizer.m b/iPhone/GTMUILocalizer.m index 7923d05..269d2f6 100644 --- a/iPhone/GTMUILocalizer.m +++ b/iPhone/GTMUILocalizer.m @@ -25,6 +25,7 @@ // Never recursively call any of these methods. Always call // -[self localizeObject:recursively:]. - (void)localizeToolbar:(UIToolbar *)toolbar; +- (void)localizeSegmentedControl:(UISegmentedControl *)segmentedControl; - (void)localizeView:(UIView *)view recursively:(BOOL)recursive; - (void)localizeButton:(UIButton *)button; @end @@ -96,10 +97,12 @@ if ([object isKindOfClass:[UIViewController class]]) { UIView *view = [object view]; [self localizeView:view recursively:recursive]; - } else if ([object isKindOfClass:[UIView class]]) { - [self localizeView:(UIView *)object recursively:recursive]; } else if ([object isKindOfClass:[UIToolbar class]]) { [self localizeToolbar:(UIToolbar*)object]; + } else if ([object isKindOfClass:[UISegmentedControl class]]) { + [self localizeSegmentedControl:(UISegmentedControl*)object]; + } else if ([object isKindOfClass:[UIView class]]) { + [self localizeView:(UIView *)object recursively:recursive]; } } } @@ -119,6 +122,23 @@ } } +- (void)localizeSegmentedControl:(UISegmentedControl *)segmentedControl { + // A UISegmentedControl uses a few objects as subviews, but they aren't + // documented. It happened to work out that their inherritance was right + // with the selectors they implemented that things localized, but iOS 6 + // changed some of that, so they are now directly handled. + NSUInteger numberOfSegments = segmentedControl.numberOfSegments; + for (NSUInteger i = 0; i < numberOfSegments; ++i) { + NSString *title = [segmentedControl titleForSegmentAtIndex:i]; + if (title) { + title = [self localizedStringForString:title]; + if (title) { + [segmentedControl setTitle:title forSegmentAtIndex:i]; + } + } + } +} + - (void)localizeView:(UIView *)view recursively:(BOOL)recursive { if (view) { // Do accessibility on views. diff --git a/iPhone/TestData/GTMFadeTruncatingLabelTest1.6.png b/iPhone/TestData/GTMFadeTruncatingLabelTest1.6.png new file mode 100644 index 0000000..e2a2777 Binary files /dev/null and b/iPhone/TestData/GTMFadeTruncatingLabelTest1.6.png differ diff --git a/iPhone/TestData/GTMFadeTruncatingLabelTest2.6.png b/iPhone/TestData/GTMFadeTruncatingLabelTest2.6.png new file mode 100644 index 0000000..cb840ba Binary files /dev/null and b/iPhone/TestData/GTMFadeTruncatingLabelTest2.6.png differ diff --git a/iPhone/TestData/GTMFadeTruncatingLabelTest3.6.png b/iPhone/TestData/GTMFadeTruncatingLabelTest3.6.png new file mode 100644 index 0000000..b9a07fa Binary files /dev/null and b/iPhone/TestData/GTMFadeTruncatingLabelTest3.6.png differ diff --git a/iPhone/TestData/GTMFadeTruncatingLabelTest4.6.png b/iPhone/TestData/GTMFadeTruncatingLabelTest4.6.png new file mode 100644 index 0000000..1fecc29 Binary files /dev/null and b/iPhone/TestData/GTMFadeTruncatingLabelTest4.6.png differ diff --git a/iPhone/TestData/GTMFadeTruncatingLabelTest5.6.png b/iPhone/TestData/GTMFadeTruncatingLabelTest5.6.png new file mode 100644 index 0000000..8c2db75 Binary files /dev/null and b/iPhone/TestData/GTMFadeTruncatingLabelTest5.6.png differ -- cgit v1.2.3