diff --git a/iTunesSearch.xcodeproj/project.pbxproj b/iTunesSearch.xcodeproj/project.pbxproj index 79e06d7..104bf96 100644 --- a/iTunesSearch.xcodeproj/project.pbxproj +++ b/iTunesSearch.xcodeproj/project.pbxproj @@ -12,11 +12,22 @@ 92C21CBC1AAE757A0052ABE6 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CBB1AAE757A0052ABE6 /* TableViewController.m */; }; 92C21CC11AAE757A0052ABE6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92C21CC01AAE757A0052ABE6 /* Images.xcassets */; }; 92C21CD01AAE757A0052ABE6 /* iTunesSearchTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CCF1AAE757A0052ABE6 /* iTunesSearchTests.m */; }; - 92C21CDB1AAE75B30052ABE6 /* iTunesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CDA1AAE75B30052ABE6 /* iTunesManager.m */; }; - 92C21CDD1AAE75DC0052ABE6 /* TableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 92C21CDC1AAE75DC0052ABE6 /* TableView.xib */; }; 92C21CE11AAE76930052ABE6 /* TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CDF1AAE76930052ABE6 /* TableViewCell.m */; }; 92C21CE21AAE76930052ABE6 /* TableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 92C21CE01AAE76930052ABE6 /* TableViewCell.xib */; }; 92C21CE81AAE858E0052ABE6 /* Filme.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CE71AAE858E0052ABE6 /* Filme.m */; }; + D41463941AB368D700181638 /* TableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D41463961AB368D700181638 /* TableView.xib */; }; + D414639E1AB3696300181638 /* TableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D41463961AB368D700181638 /* TableView.xib */; }; + D41463AE1AB36A8400181638 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = D41463AD1AB36A8400181638 /* Info.plist */; }; + D41463B21AB36ADE00181638 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = D41463B41AB36ADE00181638 /* Localizable.strings */; }; + D41463B71AB36ADF00181638 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D41463B91AB36ADF00181638 /* InfoPlist.strings */; }; + D41463BF1AB377FA00181638 /* iTunesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D41463BE1AB377FA00181638 /* iTunesManager.m */; }; + D490205F1AB35EA800803E9C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D490205E1AB35EA800803E9C /* main.m */; }; + D49020641AB35F2500803E9C /* Ebook.m in Sources */ = {isa = PBXBuildFile; fileRef = D49020611AB35F2500803E9C /* Ebook.m */; }; + D49020651AB35F2500803E9C /* Musica.m in Sources */ = {isa = PBXBuildFile; fileRef = D49020631AB35F2500803E9C /* Musica.m */; }; + D49020681AB35F5900803E9C /* Podcast.m in Sources */ = {isa = PBXBuildFile; fileRef = D49020671AB35F5900803E9C /* Podcast.m */; }; + D490206C1AB35F8A00803E9C /* Detalhes.m in Sources */ = {isa = PBXBuildFile; fileRef = D490206A1AB35F8A00803E9C /* Detalhes.m */; }; + D490206D1AB35F8A00803E9C /* Detalhes.xib in Resources */ = {isa = PBXBuildFile; fileRef = D490206B1AB35F8A00803E9C /* Detalhes.xib */; }; + D49B8FDF1AB3636200A21394 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D49B8FE11AB3636200A21394 /* InfoPlist.strings */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -42,13 +53,33 @@ 92C21CCE1AAE757A0052ABE6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 92C21CCF1AAE757A0052ABE6 /* iTunesSearchTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iTunesSearchTests.m; sourceTree = ""; }; 92C21CD91AAE75B30052ABE6 /* iTunesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iTunesManager.h; sourceTree = ""; }; - 92C21CDA1AAE75B30052ABE6 /* iTunesManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iTunesManager.m; sourceTree = ""; }; - 92C21CDC1AAE75DC0052ABE6 /* TableView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableView.xib; sourceTree = ""; }; 92C21CDE1AAE76930052ABE6 /* TableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewCell.h; sourceTree = ""; }; 92C21CDF1AAE76930052ABE6 /* TableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewCell.m; sourceTree = ""; }; 92C21CE01AAE76930052ABE6 /* TableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableViewCell.xib; sourceTree = ""; }; 92C21CE61AAE858E0052ABE6 /* Filme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Filme.h; path = Entidades/Filme.h; sourceTree = ""; }; 92C21CE71AAE858E0052ABE6 /* Filme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Filme.m; path = Entidades/Filme.m; sourceTree = ""; }; + D41463951AB368D700181638 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/TableView.xib; sourceTree = ""; }; + D414639F1AB3698100181638 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/TableView.xib; sourceTree = ""; }; + D41463A01AB3698100181638 /* pt */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = pt; path = pt.lproj/TableView.xib; sourceTree = ""; }; + D41463AD1AB36A8400181638 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D41463AF1AB36AB800181638 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/TableView.xib; sourceTree = ""; }; + D41463B31AB36ADE00181638 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; + D41463B81AB36ADF00181638 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; + D41463BA1AB36AEA00181638 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = ""; }; + D41463BB1AB36AEB00181638 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; + D41463BE1AB377FA00181638 /* iTunesManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iTunesManager.m; sourceTree = ""; }; + D490205E1AB35EA800803E9C /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iTunesSearch/main.m; sourceTree = SOURCE_ROOT; }; + D49020601AB35F2500803E9C /* Ebook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Ebook.h; path = Entidades/Ebook.h; sourceTree = ""; }; + D49020611AB35F2500803E9C /* Ebook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Ebook.m; path = Entidades/Ebook.m; sourceTree = ""; }; + D49020621AB35F2500803E9C /* Musica.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Musica.h; path = Entidades/Musica.h; sourceTree = ""; }; + D49020631AB35F2500803E9C /* Musica.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Musica.m; path = Entidades/Musica.m; sourceTree = ""; }; + D49020661AB35F5900803E9C /* Podcast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Podcast.h; path = Entidades/Podcast.h; sourceTree = ""; }; + D49020671AB35F5900803E9C /* Podcast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Podcast.m; path = Entidades/Podcast.m; sourceTree = ""; }; + D49020691AB35F8A00803E9C /* Detalhes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Detalhes.h; sourceTree = ""; }; + D490206A1AB35F8A00803E9C /* Detalhes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Detalhes.m; sourceTree = ""; }; + D490206B1AB35F8A00803E9C /* Detalhes.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Detalhes.xib; sourceTree = ""; }; + D49B8FE01AB3636200A21394 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; + D4E855EB1AB3639D000D86C9 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -96,9 +127,12 @@ 92C21CB81AAE757A0052ABE6 /* AppDelegate.m */, 92C21CBA1AAE757A0052ABE6 /* TableViewController.h */, 92C21CBB1AAE757A0052ABE6 /* TableViewController.m */, - 92C21CDC1AAE75DC0052ABE6 /* TableView.xib */, + D41463961AB368D700181638 /* TableView.xib */, 92C21CD91AAE75B30052ABE6 /* iTunesManager.h */, - 92C21CDA1AAE75B30052ABE6 /* iTunesManager.m */, + D41463BE1AB377FA00181638 /* iTunesManager.m */, + D49020691AB35F8A00803E9C /* Detalhes.h */, + D490206A1AB35F8A00803E9C /* Detalhes.m */, + D490206B1AB35F8A00803E9C /* Detalhes.xib */, 92C21CC01AAE757A0052ABE6 /* Images.xcassets */, 92C21CB31AAE757A0052ABE6 /* Supporting Files */, ); @@ -108,6 +142,8 @@ 92C21CB31AAE757A0052ABE6 /* Supporting Files */ = { isa = PBXGroup; children = ( + D41463B91AB36ADF00181638 /* InfoPlist.strings */, + D41463B41AB36ADE00181638 /* Localizable.strings */, 92C21CB41AAE757A0052ABE6 /* Info.plist */, 92C21CB51AAE757A0052ABE6 /* main.m */, ); @@ -117,6 +153,7 @@ 92C21CCC1AAE757A0052ABE6 /* iTunesSearchTests */ = { isa = PBXGroup; children = ( + D41463AD1AB36A8400181638 /* Info.plist */, 92C21CCF1AAE757A0052ABE6 /* iTunesSearchTests.m */, 92C21CCD1AAE757A0052ABE6 /* Supporting Files */, ); @@ -126,7 +163,9 @@ 92C21CCD1AAE757A0052ABE6 /* Supporting Files */ = { isa = PBXGroup; children = ( + D49B8FE11AB3636200A21394 /* InfoPlist.strings */, 92C21CCE1AAE757A0052ABE6 /* Info.plist */, + D490205E1AB35EA800803E9C /* main.m */, ); name = "Supporting Files"; sourceTree = ""; @@ -144,8 +183,14 @@ 92C21CE91AAE859A0052ABE6 /* Entidades */ = { isa = PBXGroup; children = ( + D49020661AB35F5900803E9C /* Podcast.h */, + D49020671AB35F5900803E9C /* Podcast.m */, 92C21CE61AAE858E0052ABE6 /* Filme.h */, 92C21CE71AAE858E0052ABE6 /* Filme.m */, + D49020601AB35F2500803E9C /* Ebook.h */, + D49020611AB35F2500803E9C /* Ebook.m */, + D49020621AB35F2500803E9C /* Musica.h */, + D49020631AB35F2500803E9C /* Musica.m */, ); name = Entidades; sourceTree = ""; @@ -213,6 +258,8 @@ knownRegions = ( en, Base, + fr, + pt, ); mainGroup = 92C21CA71AAE757A0052ABE6; productRefGroup = 92C21CB11AAE757A0052ABE6 /* Products */; @@ -230,9 +277,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + D41463B21AB36ADE00181638 /* Localizable.strings in Resources */, + D41463B71AB36ADF00181638 /* InfoPlist.strings in Resources */, 92C21CC11AAE757A0052ABE6 /* Images.xcassets in Resources */, 92C21CE21AAE76930052ABE6 /* TableViewCell.xib in Resources */, - 92C21CDD1AAE75DC0052ABE6 /* TableView.xib in Resources */, + D41463941AB368D700181638 /* TableView.xib in Resources */, + D490206D1AB35F8A00803E9C /* Detalhes.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -240,6 +290,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + D414639E1AB3696300181638 /* TableView.xib in Resources */, + D49B8FDF1AB3636200A21394 /* InfoPlist.strings in Resources */, + D41463AE1AB36A8400181638 /* Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -251,11 +304,15 @@ buildActionMask = 2147483647; files = ( 92C21CBC1AAE757A0052ABE6 /* TableViewController.m in Sources */, - 92C21CDB1AAE75B30052ABE6 /* iTunesManager.m in Sources */, + D490206C1AB35F8A00803E9C /* Detalhes.m in Sources */, 92C21CB91AAE757A0052ABE6 /* AppDelegate.m in Sources */, + D49020681AB35F5900803E9C /* Podcast.m in Sources */, 92C21CE81AAE858E0052ABE6 /* Filme.m in Sources */, 92C21CE11AAE76930052ABE6 /* TableViewCell.m in Sources */, + D49020651AB35F2500803E9C /* Musica.m in Sources */, 92C21CB61AAE757A0052ABE6 /* main.m in Sources */, + D49020641AB35F2500803E9C /* Ebook.m in Sources */, + D41463BF1AB377FA00181638 /* iTunesManager.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -263,6 +320,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + D490205F1AB35EA800803E9C /* main.m in Sources */, 92C21CD01AAE757A0052ABE6 /* iTunesSearchTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -277,6 +335,47 @@ }; /* End PBXTargetDependency section */ +/* Begin PBXVariantGroup section */ + D41463961AB368D700181638 /* TableView.xib */ = { + isa = PBXVariantGroup; + children = ( + D41463951AB368D700181638 /* en */, + D414639F1AB3698100181638 /* fr */, + D41463A01AB3698100181638 /* pt */, + D41463AF1AB36AB800181638 /* Base */, + ); + name = TableView.xib; + sourceTree = ""; + }; + D41463B41AB36ADE00181638 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + D41463B31AB36ADE00181638 /* fr */, + D41463BA1AB36AEA00181638 /* pt */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + D41463B91AB36ADF00181638 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + D41463B81AB36ADF00181638 /* fr */, + D41463BB1AB36AEB00181638 /* pt */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + D49B8FE11AB3636200A21394 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + D49B8FE01AB3636200A21394 /* fr */, + D4E855EB1AB3639D000D86C9 /* pt */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 92C21CD11AAE757A0052ABE6 /* Debug */ = { isa = XCBuildConfiguration; diff --git a/iTunesSearch/AppDelegate.m b/iTunesSearch/AppDelegate.m index d513fd8..4957daf 100644 --- a/iTunesSearch/AppDelegate.m +++ b/iTunesSearch/AppDelegate.m @@ -22,17 +22,16 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( #warning Necessário para inicializar a aplicacao sem storyboard self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; -#warning Adicionado codigo para iniciar com a interface do TableView -// TableViewController *tvc = [[TableViewController alloc] initWithNibName:@"TableView" bundle:nil]; - TableViewController *tvc = [[TableViewController alloc] init]; - [self.window setRootViewController:tvc]; + TableViewController *tvc = [[TableViewController alloc]init]; + + UINavigationController *nc = [[UINavigationController alloc]initWithRootViewController:tvc]; + [[self window] setRootViewController:nc]; [self.window makeKeyAndVisible]; return YES; + } - - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. diff --git a/iTunesSearch/Base.lproj/TableView.xib b/iTunesSearch/Base.lproj/TableView.xib new file mode 100644 index 0000000..bd77034 --- /dev/null +++ b/iTunesSearch/Base.lproj/TableView.xib @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iTunesSearch/Detalhes.h b/iTunesSearch/Detalhes.h new file mode 100644 index 0000000..e6d680d --- /dev/null +++ b/iTunesSearch/Detalhes.h @@ -0,0 +1,22 @@ +// +// Detalhes.h +// iTunesSearch +// +// Created by Victor Lisboa on 13/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import + +@interface Detalhes : UIViewController + +@property (weak, nonatomic) IBOutlet UIImageView *imgUrl; +@property (weak, nonatomic) IBOutlet UILabel *nome; +@property (weak, nonatomic) IBOutlet UILabel *preco; +@property (weak, nonatomic) IBOutlet UILabel *tipo; +@property (weak, nonatomic) IBOutlet UILabel *artista; +@property (weak, nonatomic) IBOutlet UILabel *pais; +@property (weak, nonatomic) IBOutlet UILabel *genero; +@property NSUInteger row; +@property NSUInteger section; +@end diff --git a/iTunesSearch/Detalhes.m b/iTunesSearch/Detalhes.m new file mode 100644 index 0000000..430f0ec --- /dev/null +++ b/iTunesSearch/Detalhes.m @@ -0,0 +1,102 @@ +// +// Detalhes.m +// iTunesSearch +// +// Created by Victor Lisboa on 13/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import "TableViewController.h" +#import "TableViewCell.h" +#import "iTunesManager.h" +#import "Entidades/Filme.h" +#import "Entidades/Ebook.h" +#import "Entidades/Podcast.h" +#import "Entidades/Musica.h" +#import "Detalhes.h" + + +@interface Detalhes () + +@end + +@implementation Detalhes + +@synthesize row,section; + +- (void)viewDidLoad { + [super viewDidLoad]; + self.navigationItem.title = @"Detalhes"; + // Do any additional setup after loading the view from its nib. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} +-(void)viewWillAppear:(BOOL)animated{ + iTunesManager *im =[iTunesManager sharedInstance]; + id obje = [[im.midia objectAtIndex:section] objectAtIndex:row]; + + + switch (section) { + case 0:{ + Filme *f = obje; + [_nome setText:f.nome]; + [_tipo setText:@"Movie"]; + [_artista setText:f.artista]; + [_genero setText:f.genero]; + [_preco setText:[NSString stringWithFormat: @"US$ %@", f.preco]]; + [_pais setText:f.pais]; + [_imgUrl setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:f.imgUrl]]]]; + } + break; + case 1:{ + Ebook *b = obje; + [_nome setText:b.nomeb]; + [_tipo setText:@"Book"]; + [_artista setText:b.artistab]; + [_genero setText:b.generob]; + [_pais setText:b.paisb]; + [_preco setText:[NSString stringWithFormat: @"US$ %@", b.precob]]; + [_imgUrl setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:b.imgUrlb]]]]; + } + break; + case 2:{ + Podcast *p = obje; + [_nome setText:p.nomep]; + [_tipo setText:@"Podcast"]; + [_artista setText:p.artistap]; + [_genero setText:p.generop]; + [_preco setText:[NSString stringWithFormat: @"US$ %@", p.precop]]; + [_pais setText:p.paisp]; + [_imgUrl setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:p.imgUrlp]]]]; + } + break; + case 3:{ + Musica *m = obje; + [_nome setText:m.nomem]; + [_artista setText:m.artistam]; + [_tipo setText:@"Music"]; + [_genero setText:m.generom]; + [_preco setText:[NSString stringWithFormat: @"US$ %@", m.precom]]; + [_pais setText:m.paism]; + [_imgUrl setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:m.imgUrlm]]]]; + } + break; + default: + break; + + +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ +} +@end diff --git a/iTunesSearch/Detalhes.xib b/iTunesSearch/Detalhes.xib new file mode 100644 index 0000000..dee8966 --- /dev/null +++ b/iTunesSearch/Detalhes.xib @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iTunesSearch/Entidades/Ebook.h b/iTunesSearch/Entidades/Ebook.h new file mode 100644 index 0000000..c4ae329 --- /dev/null +++ b/iTunesSearch/Entidades/Ebook.h @@ -0,0 +1,23 @@ +// +// Ebook.h +// iTunesSearch +// +// Created by Victor Lisboa on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import + +@interface Ebook : NSObject + +@property (nonatomic, strong) NSString *nomeb; +@property (nonatomic, strong) NSString *trackIdb; +@property (nonatomic, strong) NSString *artistab; +@property (nonatomic, strong) NSString *generob; +@property (nonatomic, strong) NSString *idiomab; +@property (nonatomic, strong) NSString *paginasb; +@property (nonatomic, strong) NSString *precob; +@property (nonatomic, strong) NSString *paisb; +@property (nonatomic, strong) NSString *imgUrlb; + +@end diff --git a/iTunesSearch/Entidades/Ebook.m b/iTunesSearch/Entidades/Ebook.m new file mode 100644 index 0000000..96373bd --- /dev/null +++ b/iTunesSearch/Entidades/Ebook.m @@ -0,0 +1,13 @@ +// +// Ebook.m +// iTunesSearch +// +// Created by Victor Lisboa on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import "Ebook.h" + +@implementation Ebook + +@end \ No newline at end of file diff --git a/iTunesSearch/Entidades/Filme.h b/iTunesSearch/Entidades/Filme.h index eb126dc..2e35454 100644 --- a/iTunesSearch/Entidades/Filme.h +++ b/iTunesSearch/Entidades/Filme.h @@ -16,5 +16,8 @@ @property (nonatomic, strong) NSString *duracao; @property (nonatomic, strong) NSString *genero; @property (nonatomic, strong) NSString *pais; +@property (nonatomic, strong) NSString *preco; +@property (nonatomic, strong) NSString *imgUrl; + @end diff --git a/iTunesSearch/Entidades/Musica.h b/iTunesSearch/Entidades/Musica.h new file mode 100644 index 0000000..7aedc77 --- /dev/null +++ b/iTunesSearch/Entidades/Musica.h @@ -0,0 +1,22 @@ +// +// Musica.h +// iTunesSearch +// +// Created by Victor Lisboa on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import + +@interface Musica : NSObject + +@property (nonatomic, strong) NSString *nomem; +@property (nonatomic, strong) NSString *trackIdm; +@property (nonatomic, strong) NSString *artistam; +@property (nonatomic, strong) NSString *duracaom; +@property (nonatomic, strong) NSString *generom; +@property (nonatomic, strong) NSString *paism; +@property (nonatomic, strong) NSString *precom; +@property (nonatomic, strong) NSString *imgUrlm; + +@end diff --git a/iTunesSearch/Entidades/Musica.m b/iTunesSearch/Entidades/Musica.m new file mode 100644 index 0000000..9e5dfe3 --- /dev/null +++ b/iTunesSearch/Entidades/Musica.m @@ -0,0 +1,13 @@ +// +// Musica.m +// iTunesSearch +// +// Created by Victor Lisboa on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import "Musica.h" + +@implementation Musica + +@end diff --git a/iTunesSearch/Entidades/Podcast.h b/iTunesSearch/Entidades/Podcast.h new file mode 100644 index 0000000..6282297 --- /dev/null +++ b/iTunesSearch/Entidades/Podcast.h @@ -0,0 +1,21 @@ +// +// Podcast.h +// iTunesSearch +// +// Created by Victor Lisboa on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import + +@interface Podcast : NSObject + +@property (nonatomic, strong) NSString *nomep; +@property (nonatomic, strong) NSString *trackIdp; +@property (nonatomic, strong) NSString *artistap; +@property (nonatomic, strong) NSString *duracaop; +@property (nonatomic, strong) NSString *generop; +@property (nonatomic, strong) NSString *paisp; +@property (nonatomic, strong) NSString *precop; +@property (nonatomic, strong) NSString *imgUrlp; +@end diff --git a/iTunesSearch/Entidades/Podcast.m b/iTunesSearch/Entidades/Podcast.m new file mode 100644 index 0000000..5feff35 --- /dev/null +++ b/iTunesSearch/Entidades/Podcast.m @@ -0,0 +1,13 @@ +// +// Podcast.m +// iTunesSearch +// +// Created by Victor Lisboa on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import "Podcast.h" + +@implementation Podcast + +@end diff --git a/iTunesSearch/Images.xcassets/Open_Book-512.imageset/Contents.json b/iTunesSearch/Images.xcassets/Open_Book-512.imageset/Contents.json new file mode 100644 index 0000000..568ef73 --- /dev/null +++ b/iTunesSearch/Images.xcassets/Open_Book-512.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "Open_Book-512.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iTunesSearch/Images.xcassets/Open_Book-512.imageset/Open_Book-512.png b/iTunesSearch/Images.xcassets/Open_Book-512.imageset/Open_Book-512.png new file mode 100644 index 0000000..9dba1d9 Binary files /dev/null and b/iTunesSearch/Images.xcassets/Open_Book-512.imageset/Open_Book-512.png differ diff --git a/iTunesSearch/Images.xcassets/film.imageset/Contents.json b/iTunesSearch/Images.xcassets/film.imageset/Contents.json new file mode 100644 index 0000000..4983fa8 --- /dev/null +++ b/iTunesSearch/Images.xcassets/film.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "film-2.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iTunesSearch/Images.xcassets/film.imageset/film-2.png b/iTunesSearch/Images.xcassets/film.imageset/film-2.png new file mode 100644 index 0000000..574bdd9 Binary files /dev/null and b/iTunesSearch/Images.xcassets/film.imageset/film-2.png differ diff --git a/iTunesSearch/Images.xcassets/music.imageset/Contents.json b/iTunesSearch/Images.xcassets/music.imageset/Contents.json new file mode 100644 index 0000000..b8e896f --- /dev/null +++ b/iTunesSearch/Images.xcassets/music.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "music.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iTunesSearch/Images.xcassets/music.imageset/music.png b/iTunesSearch/Images.xcassets/music.imageset/music.png new file mode 100644 index 0000000..c7cba43 Binary files /dev/null and b/iTunesSearch/Images.xcassets/music.imageset/music.png differ diff --git a/iTunesSearch/Images.xcassets/podcast.imageset/Contents.json b/iTunesSearch/Images.xcassets/podcast.imageset/Contents.json new file mode 100644 index 0000000..4416319 --- /dev/null +++ b/iTunesSearch/Images.xcassets/podcast.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "podcast.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iTunesSearch/Images.xcassets/podcast.imageset/podcast.png b/iTunesSearch/Images.xcassets/podcast.imageset/podcast.png new file mode 100644 index 0000000..a19f5b3 Binary files /dev/null and b/iTunesSearch/Images.xcassets/podcast.imageset/podcast.png differ diff --git a/iTunesSearch/TableView.xib b/iTunesSearch/TableView.xib deleted file mode 100644 index 55f128c..0000000 --- a/iTunesSearch/TableView.xib +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/iTunesSearch/TableViewCell.h b/iTunesSearch/TableViewCell.h index b630349..a84190b 100644 --- a/iTunesSearch/TableViewCell.h +++ b/iTunesSearch/TableViewCell.h @@ -12,6 +12,9 @@ @property (weak, nonatomic) IBOutlet UILabel *nome; @property (weak, nonatomic) IBOutlet UILabel *tipo; - +@property (weak, nonatomic) IBOutlet UILabel *genero; +@property (weak, nonatomic) IBOutlet UILabel *preco; +@property (weak, nonatomic) IBOutlet UILabel *duracao; +@property (weak, nonatomic) IBOutlet UIImageView *imgUrl; @end diff --git a/iTunesSearch/TableViewCell.xib b/iTunesSearch/TableViewCell.xib index bf8bd3f..682166d 100644 --- a/iTunesSearch/TableViewCell.xib +++ b/iTunesSearch/TableViewCell.xib @@ -1,5 +1,5 @@ - + @@ -7,40 +7,78 @@ - - + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + - + diff --git a/iTunesSearch/TableViewController.h b/iTunesSearch/TableViewController.h index 0cbb5c4..33074e4 100644 --- a/iTunesSearch/TableViewController.h +++ b/iTunesSearch/TableViewController.h @@ -11,7 +11,12 @@ @interface TableViewController : UIViewController +@property (strong, nonatomic) IBOutlet UIView *view; @property (strong, nonatomic) IBOutlet UITableView *tableview; +@property (strong, nonatomic) IBOutlet UIButton *button; +@property (strong, nonatomic) IBOutlet UITextField *searchBar; +@property NSString *txtSearch; +- (IBAction)button:(id)sender; @end diff --git a/iTunesSearch/TableViewController.m b/iTunesSearch/TableViewController.m index f689980..2828fb0 100644 --- a/iTunesSearch/TableViewController.m +++ b/iTunesSearch/TableViewController.m @@ -10,9 +10,17 @@ #import "TableViewCell.h" #import "iTunesManager.h" #import "Entidades/Filme.h" +#import "Entidades/Ebook.h" +#import "Entidades/Podcast.h" +#import "Entidades/Musica.h" +#import "Detalhes.h" + + @interface TableViewController () { NSArray *midias; + NSArray *mid; +// NSString *strSearch; } @end @@ -23,15 +31,15 @@ @implementation TableViewController - (void)viewDidLoad { [super viewDidLoad]; - + _tableview.delegate = self; + _tableview.dataSource = self; UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:nil]; [self.tableview registerNib:nib forCellReuseIdentifier:@"celulaPadrao"]; - - iTunesManager *itunes = [iTunesManager sharedInstance]; - midias = [itunes buscarMidias:@"Apple"]; - + [_button setTitle: NSLocalizedString(@"Search", @"Botão")forState:UIControlStateNormal]; + self.navigationController.navigationBar.translucent = NO; #warning Necessario para que a table view tenha um espaco em relacao ao topo, pois caso contrario o texto ficara atras da barra superior self.tableview.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 15.f)]; + } - (void)didReceiveMemoryWarning { @@ -42,27 +50,140 @@ - (void)didReceiveMemoryWarning { #pragma mark - Metodos do UITableViewDataSource -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; + return [midias count]; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [midias count]; + return [[midias objectAtIndex:section]count]; +} +-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ + switch (section) { + +case 0: return @"Movie"; +case 1: return @"Book"; +case 2: return @"Podcast"; +case 3: return @"Music"; + } + return @"oi"; } - -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { TableViewCell *celula = [self.tableview dequeueReusableCellWithIdentifier:@"celulaPadrao"]; + mid = [[NSArray alloc] initWithArray:[midias objectAtIndex:indexPath.section]]; + + Filme *filme; + Ebook *ebook; + Podcast *podcast; + Musica *musica; - Filme *filme = [midias objectAtIndex:indexPath.row]; + long row = [indexPath row]; - [celula.nome setText:filme.nome]; - [celula.tipo setText:@"Filme"]; + switch (indexPath.section) { + case 0:{ + filme = [mid objectAtIndex:row]; + [celula.nome setText:filme.nome]; + [celula.tipo setText:@"Movie"]; + [celula.genero setText:filme.genero]; + [celula.preco setText:[NSString stringWithFormat: @"US$ %@", filme.preco]]; + [celula.duracao setText:[self formatInterval:[NSString stringWithFormat: @"%@", filme.duracao]]]; + NSURL *urlf = [NSURL URLWithString:filme.imgUrl]; + NSData *imgDataf = [NSData dataWithContentsOfURL:urlf]; + UIImage *imgf = [UIImage imageWithData:imgDataf]; + [celula.imageView setImage:imgf]; + } + break; + case 1:{ + ebook = [mid objectAtIndex:row]; + [celula.nome setText:ebook.nomeb]; + [celula.tipo setText:@"Book"]; + [celula.genero setText:ebook.generob]; + [celula.preco setText:[NSString stringWithFormat: @"US$ %@", ebook.precob]]; + NSURL *urlb = [NSURL URLWithString:ebook.imgUrlb]; + NSData *imgDatab = [NSData dataWithContentsOfURL:urlb]; + UIImage *imgb = [UIImage imageWithData:imgDatab]; + [celula.imageView setImage:imgb]; + } + break; + case 2:{ + podcast = [mid objectAtIndex:row]; + [celula.nome setText:podcast.nomep]; + [celula.tipo setText:@"Podcast"]; + [celula.genero setText:podcast.generop]; + [celula.preco setText:[NSString stringWithFormat: @"US$ %@", podcast.precop]]; + [celula.duracao setText:[self formatInterval:[NSString stringWithFormat: @"%@", podcast.duracaop]]]; + NSURL *urlp = [NSURL URLWithString:podcast.imgUrlp]; + NSData *imgDatap = [NSData dataWithContentsOfURL:urlp]; + UIImage *imgp = [UIImage imageWithData:imgDatap]; + [celula.imageView setImage:imgp]; + } + break; + case 3:{ + musica = [mid objectAtIndex:row]; + [celula.nome setText:musica.nomem]; + [celula.tipo setText:@"Music"]; + [celula.genero setText:musica.generom]; + [celula.preco setText:[NSString stringWithFormat: @"US$ %@", musica.precom]]; + [celula.duracao setText:[self formatInterval:[NSString stringWithFormat: @"%@", musica.duracaom]]]; + NSURL *urlm = [NSURL URLWithString:musica.imgUrlm]; + NSData *imgDatam = [NSData dataWithContentsOfURL:urlm]; + UIImage *imgm = [UIImage imageWithData:imgDatam]; + [celula.imageView setImage:imgm]; + } + break; + default: + break; + } return celula; } +- (NSString *) formatInterval: (NSString *) time{ + NSTimeInterval interval; + if([time doubleValue]){ + interval = [time doubleValue]; + } + else { + interval = 0.0; + } + unsigned long milliseconds = interval; + unsigned long seconds = milliseconds / 1000; + milliseconds %= 1000; + unsigned long minutes = seconds / 60; + seconds %= 60; + unsigned long hours = minutes / 60; + minutes %= 60; + + NSMutableString * result = [NSMutableString new]; + + if(hours) + [result appendFormat: @"%lu:", hours]; + + [result appendFormat: @"%lu:", minutes]; + [result appendFormat: @"%lu", seconds]; + + return result; +} + -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 70; + return 150; } +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ + Detalhes *det = [[Detalhes alloc]init]; + det.row = [indexPath row]; + det.section = [indexPath section]; + [[self navigationController]pushViewController:det animated:YES]; +} +- (IBAction)button:(id)sender { + _txtSearch=_searchBar.text; + _txtSearch=[_txtSearch stringByReplacingOccurrencesOfString:@" " withString:@"+"]; + iTunesManager *itunes =[iTunesManager sharedInstance]; + midias = [itunes buscarMidias:_txtSearch]; + [self.tableview reloadData]; +} + + +-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ + [_searchBar resignFirstResponder]; +} @end diff --git a/iTunesSearch/en.lproj/TableView.xib b/iTunesSearch/en.lproj/TableView.xib new file mode 100644 index 0000000..bf32802 --- /dev/null +++ b/iTunesSearch/en.lproj/TableView.xib @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iTunesSearch/fr.lproj/InfoPlist.strings b/iTunesSearch/fr.lproj/InfoPlist.strings new file mode 100644 index 0000000..dc62739 --- /dev/null +++ b/iTunesSearch/fr.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* No Localized Strings */ \ No newline at end of file diff --git a/iTunesSearch/fr.lproj/Localizable.strings b/iTunesSearch/fr.lproj/Localizable.strings new file mode 100644 index 0000000..19b8eeb --- /dev/null +++ b/iTunesSearch/fr.lproj/Localizable.strings @@ -0,0 +1,2 @@ +/* Botão */ +"Search" = " Recherche "; diff --git a/iTunesSearch/fr.lproj/TableView.xib b/iTunesSearch/fr.lproj/TableView.xib new file mode 100644 index 0000000..ec2019c --- /dev/null +++ b/iTunesSearch/fr.lproj/TableView.xib @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iTunesSearch/iTunesManager.h b/iTunesSearch/iTunesManager.h index c0e366b..b44167e 100644 --- a/iTunesSearch/iTunesManager.h +++ b/iTunesSearch/iTunesManager.h @@ -9,7 +9,6 @@ #import @interface iTunesManager : NSObject - /** * gets singleton object. * @return singleton @@ -17,5 +16,5 @@ + (iTunesManager*)sharedInstance; - (NSArray *)buscarMidias:(NSString *)termo; - +@property NSArray* midia; @end diff --git a/iTunesSearch/iTunesManager.m b/iTunesSearch/iTunesManager.m index e2babda..32f691b 100644 --- a/iTunesSearch/iTunesManager.m +++ b/iTunesSearch/iTunesManager.m @@ -8,6 +8,9 @@ #import "iTunesManager.h" #import "Entidades/Filme.h" +#import "Entidades/Ebook.h" +#import "Entidades/Podcast.h" +#import "Entidades/Musica.h" @implementation iTunesManager @@ -22,7 +25,7 @@ + (id)sharedInstance static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ isFirstAccess = NO; - SINGLETON = [[super allocWithZone:NULL] init]; + SINGLETON = [[super allocWithZone:NULL] init]; }); return SINGLETON; @@ -34,7 +37,7 @@ - (NSArray *)buscarMidias:(NSString *)termo { termo = @""; } - NSString *url = [NSString stringWithFormat:@"https://itunes.apple.com/search?term=%@&media=movie", termo]; + NSString *url = [NSString stringWithFormat:@"https://itunes.apple.com/search?term=%@&media=all", termo]; NSData *jsonData = [NSData dataWithContentsOfURL: [NSURL URLWithString:url]]; NSError *error; @@ -48,19 +51,63 @@ - (NSArray *)buscarMidias:(NSString *)termo { NSArray *resultados = [resultado objectForKey:@"results"]; NSMutableArray *filmes = [[NSMutableArray alloc] init]; - + NSMutableArray *ebooks = [[NSMutableArray alloc] init]; + NSMutableArray *podcasts = [[NSMutableArray alloc] init]; + NSMutableArray *musicas = [[NSMutableArray alloc] init]; + NSString *type; for (NSDictionary *item in resultados) { - Filme *filme = [[Filme alloc] init]; - [filme setNome:[item objectForKey:@"trackName"]]; - [filme setTrackId:[item objectForKey:@"trackId"]]; - [filme setArtista:[item objectForKey:@"artistName"]]; - [filme setDuracao:[item objectForKey:@"trackTimeMillis"]]; - [filme setGenero:[item objectForKey:@"primaryGenreName"]]; - [filme setPais:[item objectForKey:@"country"]]; - [filmes addObject:filme]; + type = [item objectForKey:@"kind"]; + + if ([type isEqualToString:@"feature-movie"]) { + Filme *filme = [[Filme alloc] init]; + [filme setNome:[item objectForKey:@"trackName"]]; + [filme setTrackId:[item objectForKey:@"trackId"]]; + [filme setArtista:[item objectForKey:@"artistName"]]; + [filme setDuracao:[item objectForKey:@"trackTimeMillis"]]; + [filme setGenero:[item objectForKey:@"primaryGenreName"]]; + [filme setPais:[item objectForKey:@"country"]]; + [filme setPreco:[item objectForKey:@"trackPrice"]]; + [filme setImgUrl:[item objectForKey:@"artworkUrl60"]]; + [filmes addObject:filme]; + } + else if ([type isEqualToString:@"ebook"]){ + Ebook *ebook = [[Ebook alloc] init]; + [ebook setNomeb:[item objectForKey:@"trackName"]]; + [ebook setTrackIdb:[item objectForKey:@"trackId"]]; + [ebook setArtistab:[item objectForKey:@"artistName"]]; + [ebook setGenerob:[item objectForKey:@"primaryGenreName"]]; + [ebook setPrecob:[item objectForKey:@"trackPrice"]]; + [ebook setImgUrlb:[item objectForKey:@"artworkUrl60"]]; + [ebook setPaisb:[item objectForKey:@"country"]]; + [ebooks addObject:ebook]; + } + else if ([type isEqualToString:@"podcast"]){ + Podcast *podcast = [[Podcast alloc] init]; + [podcast setNomep:[item objectForKey:@"trackName"]]; + [podcast setTrackIdp:[item objectForKey:@"trackId"]]; + [podcast setArtistap:[item objectForKey:@"artistName"]]; + [podcast setDuracaop:[item objectForKey:@"trackTimeMillis"]]; + [podcast setGenerop:[item objectForKey:@"primaryGenreName"]]; + [podcast setPaisp:[item objectForKey:@"country"]]; + [podcast setPrecop:[item objectForKey:@"trackPrice"]]; + [podcast setImgUrlp:[item objectForKey:@"artworkUrl60"]]; + [podcasts addObject:podcast]; + } + else if ([type isEqualToString:@"song"]){ + Musica *musica = [[Musica alloc] init]; + [musica setNomem:[item objectForKey:@"trackName"]]; + [musica setTrackIdm:[item objectForKey:@"trackId"]]; + [musica setArtistam:[item objectForKey:@"artistName"]]; + [musica setDuracaom:[item objectForKey:@"trackTimeMillis"]]; + [musica setGenerom:[item objectForKey:@"primaryGenreName"]]; + [musica setPaism:[item objectForKey:@"country"]]; + [musica setPrecom:[item objectForKey:@"trackPrice"]]; + [musica setImgUrlm:[item objectForKey:@"artworkUrl60"]]; + [musicas addObject:musica]; + } } - - return filmes; + NSArray *mid = [[NSArray alloc]initWithObjects: filmes, ebooks, podcasts, musicas, nil]; + return mid; } diff --git a/iTunesSearch/pt.lproj/InfoPlist.strings b/iTunesSearch/pt.lproj/InfoPlist.strings new file mode 100644 index 0000000..dc62739 --- /dev/null +++ b/iTunesSearch/pt.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* No Localized Strings */ \ No newline at end of file diff --git a/iTunesSearch/pt.lproj/Localizable.strings b/iTunesSearch/pt.lproj/Localizable.strings new file mode 100644 index 0000000..a386870 --- /dev/null +++ b/iTunesSearch/pt.lproj/Localizable.strings @@ -0,0 +1,2 @@ +/* Botão */ +"Search" = " Buscar "; \ No newline at end of file diff --git a/iTunesSearch/pt.lproj/TableView.xib b/iTunesSearch/pt.lproj/TableView.xib new file mode 100644 index 0000000..5275b15 --- /dev/null +++ b/iTunesSearch/pt.lproj/TableView.xib @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iTunesSearchTests/Info.plist b/iTunesSearchTests/Info.plist index 0c9309b..a884b1c 100644 --- a/iTunesSearchTests/Info.plist +++ b/iTunesSearchTests/Info.plist @@ -13,12 +13,31 @@ CFBundleName $(PRODUCT_NAME) CFBundlePackageType - BNDL + APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + diff --git a/iTunesSearchTests/fr.lproj/InfoPlist.strings b/iTunesSearchTests/fr.lproj/InfoPlist.strings new file mode 100644 index 0000000..dc62739 --- /dev/null +++ b/iTunesSearchTests/fr.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* No Localized Strings */ \ No newline at end of file diff --git a/iTunesSearchTests/pt.lproj/InfoPlist.strings b/iTunesSearchTests/pt.lproj/InfoPlist.strings new file mode 100644 index 0000000..dc62739 --- /dev/null +++ b/iTunesSearchTests/pt.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* No Localized Strings */ \ No newline at end of file