Created
February 26, 2012 20:42
-
-
Save Dimillian/1918895 to your computer and use it in GitHub Desktop.
MSMovie
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
-(id)initWithResultSeachMovieDic:(NSDictionary *)dic | |
{ | |
self = [super init]; | |
if (self) { | |
_title = [dic objectForKey:@"name"]; | |
if ([self isNotNull:[dic objectForKey:@"alternative_name"]]) { | |
_alternateTitle = [dic objectForKey:@"alternative_name"]; | |
} | |
else{ | |
_alternateTitle = NSLocalizedString(@"No alternative title", @"No alternatie title movie object"); | |
} | |
if ([self isNotNull:[dic objectForKey:@"overview"]]) { | |
_subtitle = [dic objectForKey:@"overview"]; | |
} | |
else{ | |
_subtitle = @"No sumary"; | |
} | |
NSArray *posters = [dic objectForKey:@"posters"]; | |
if (posters.count != 0 ) { | |
NSDictionary *tinyImage = [posters objectAtIndex:2]; | |
NSDictionary *tinyImageDetail = [tinyImage objectForKey:@"image"]; | |
_tinyImageLink = [tinyImageDetail objectForKey:@"url"]; | |
} | |
else{ | |
_tinyImageLink = @""; | |
} | |
NSDateFormatter *df = [[NSDateFormatter alloc] init]; | |
[df setLocale:[NSLocale currentLocale]]; | |
[df setDateFormat:@"yyyy-MM-dd"]; | |
if ([self isNotNull:[dic objectForKey:@"released"]]) { | |
_releaseDate = [df dateFromString:[dic objectForKey:@"released"]]; | |
} | |
else{ | |
_releaseDate = [NSDate date]; | |
} | |
} | |
return self; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment