Skip to content

Instantly share code, notes, and snippets.

@koki-h
Created May 11, 2017 05:39
Show Gist options
  • Select an option

  • Save koki-h/ae59ab2313005d58edef34d9cbb4c676 to your computer and use it in GitHub Desktop.

Select an option

Save koki-h/ae59ab2313005d58edef34d9cbb4c676 to your computer and use it in GitHub Desktop.
ネストした辞書から値(int)の読み出し(Obj-C)
- (int) hls_param_get:(NSDictionary*) param key:(NSString*)key min_max:(int) min_max
{
NSArray *a = [param objectForKey:key];
NSNumber *nsnumber = (NSNumber*)a[min_max];
NSInteger value = [nsnumber integerValue];
return (int)value;
}
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
@[@0,@15], @"HRange",
@[@100,@200], @"LRange",
@[@50,@200], @"SRange", nil];
int hMin = [self hls_param_get:param key:@"HRange" min_max:0];
int hMax = [self hls_param_get:param key:@"HRange" min_max:1];
int lMin = [self hls_param_get:param key:@"LRange" min_max:0];
int lMax = [self hls_param_get:param key:@"LRange" min_max:1];
int sMin = [self hls_param_get:param key:@"SRange" min_max:0];
int sMax = [self hls_param_get:param key:@"SRange" min_max:1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment