[ios] Added +className method to NSObject

This commit is contained in:
Igor Khmurets 2014-01-17 13:14:38 +03:00 committed by Alex Zolotarev
parent e44366739f
commit 0b44e4743c
4 changed files with 11 additions and 5 deletions

View file

@ -12,6 +12,7 @@
@interface NSObject (Optimized)
+ (NSString *)className;
- (void)performAfterDelay:(NSTimeInterval)delay block:(void (^)(void))block;
@end

View file

@ -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];

View file

@ -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)

View file

@ -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);
}