Created
March 31, 2014 13:35
-
-
Save minsOne/9892363 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(NSString *)getConditionStr:(NSInteger)index | |
{ | |
static NSDictionary *mapping = nil; | |
NSString *(^getTitle)(void); | |
if (!mapping) { | |
mapping = @{ | |
@1: ^(void){ | |
return [NSString stringWithFormat:@"%@", index % 2 ? @"True1" : @"False1"]; | |
}, | |
@2: ^(void){ | |
return [NSString stringWithFormat:@"%@", index % 2 ? @"True2" : @"False2"]; | |
}, | |
@3: ^(void){ | |
return [NSString stringWithFormat:@"%@", index % 2 ? @"True3" : @"False3"]; | |
} | |
}; | |
} | |
getTitle = mapping[@(index)]; | |
return getTitle(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment