From 0b44e4743c82d3cfd248b298a62389becaac5daa Mon Sep 17 00:00:00 2001 From: Igor Khmurets Date: Fri, 17 Jan 2014 13:14:38 +0300 Subject: [PATCH] [ios] Added +className method to NSObject --- iphone/Maps/Categories/UIKitCategories.h | 1 + iphone/Maps/Categories/UIKitCategories.m | 5 +++++ iphone/Maps/Classes/MapViewController.mm | 2 +- iphone/Maps/Settings/SettingsViewController.mm | 8 ++++---- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/iphone/Maps/Categories/UIKitCategories.h b/iphone/Maps/Categories/UIKitCategories.h index 394ff63bd8..30c6878a23 100644 --- a/iphone/Maps/Categories/UIKitCategories.h +++ b/iphone/Maps/Categories/UIKitCategories.h @@ -12,6 +12,7 @@ @interface NSObject (Optimized) ++ (NSString *)className; - (void)performAfterDelay:(NSTimeInterval)delay block:(void (^)(void))block; @end diff --git a/iphone/Maps/Categories/UIKitCategories.m b/iphone/Maps/Categories/UIKitCategories.m index da9de83d30..a1042bf3ff 100644 --- a/iphone/Maps/Categories/UIKitCategories.m +++ b/iphone/Maps/Categories/UIKitCategories.m @@ -3,6 +3,11 @@ @implementation NSObject (Optimized) ++ (NSString *)className +{ + return NSStringFromClass(self); +} + - (void)performAfterDelay:(NSTimeInterval)delay block:(void (^)(void))block { [self performSelector:@selector(fireBlockAfterDelay:) withObject:[block copy] afterDelay:delay]; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index a3266dc5f6..96e1a07fdc 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -881,7 +881,7 @@ const long long LITE_IDL = 431183278L; } else if (buttonIndex == 3) { - SettingsViewController * vc = [self.mainStoryboard instantiateViewControllerWithIdentifier:NSStringFromClass([SettingsViewController class])]; + SettingsViewController * vc = [self.mainStoryboard instantiateViewControllerWithIdentifier:[SettingsViewController className]]; [self.navigationController pushViewController:vc animated:YES]; } else if (buttonIndex == 4) diff --git a/iphone/Maps/Settings/SettingsViewController.mm b/iphone/Maps/Settings/SettingsViewController.mm index c0c553177d..8ced83b475 100644 --- a/iphone/Maps/Settings/SettingsViewController.mm +++ b/iphone/Maps/Settings/SettingsViewController.mm @@ -59,7 +59,7 @@ typedef NS_ENUM(NSUInteger, Section) UITableViewCell * cell = nil; if (indexPath.section == SectionMetrics) { - cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SelectableCell class])]; + cell = [tableView dequeueReusableCellWithIdentifier:[SelectableCell className]]; Settings::Units units; if (!Settings::Get("Units", units)) units = Settings::Metric; @@ -71,7 +71,7 @@ typedef NS_ENUM(NSUInteger, Section) } else if (indexPath.section == SectionStatistics) { - cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchCell class])]; + cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]]; SwitchCell * customCell = (SwitchCell *)cell; bool on; if (!Settings::Get("StatisticsEnabled", on)) @@ -82,7 +82,7 @@ typedef NS_ENUM(NSUInteger, Section) } else if (indexPath.section == SectionZoomButtons) { - cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchCell class])]; + cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]]; SwitchCell * customCell = (SwitchCell *)cell; bool on; if (!Settings::Get("ZoomButtonsEnabled", on)) @@ -93,7 +93,7 @@ typedef NS_ENUM(NSUInteger, Section) } else if (indexPath.section == SectionAbout) { - cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([LinkCell class])]; + cell = [tableView dequeueReusableCellWithIdentifier:[LinkCell className]]; LinkCell * customCell = (LinkCell *)cell; customCell.titleLabel.text = NSLocalizedString(@"about_menu_title", nil); }