Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions iTunesSearch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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 */; };
DD0870091AB0F1B0002F0297 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DD08700B1AB0F1B0002F0297 /* Localizable.strings */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -49,6 +50,9 @@
92C21CE01AAE76930052ABE6 /* TableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableViewCell.xib; sourceTree = "<group>"; };
92C21CE61AAE858E0052ABE6 /* Filme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Filme.h; path = Entidades/Filme.h; sourceTree = "<group>"; };
92C21CE71AAE858E0052ABE6 /* Filme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Filme.m; path = Entidades/Filme.m; sourceTree = "<group>"; };
DD08700A1AB0F1B0002F0297 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
DD08700C1AB0F1C2002F0297 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = "<group>"; };
DD08700E1AB1AE46002F0297 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -101,6 +105,7 @@
92C21CDA1AAE75B30052ABE6 /* iTunesManager.m */,
92C21CC01AAE757A0052ABE6 /* Images.xcassets */,
92C21CB31AAE757A0052ABE6 /* Supporting Files */,
DD08700B1AB0F1B0002F0297 /* Localizable.strings */,
);
path = iTunesSearch;
sourceTree = "<group>";
Expand Down Expand Up @@ -213,6 +218,8 @@
knownRegions = (
en,
Base,
pt,
fr,
);
mainGroup = 92C21CA71AAE757A0052ABE6;
productRefGroup = 92C21CB11AAE757A0052ABE6 /* Products */;
Expand All @@ -233,6 +240,7 @@
92C21CC11AAE757A0052ABE6 /* Images.xcassets in Resources */,
92C21CE21AAE76930052ABE6 /* TableViewCell.xib in Resources */,
92C21CDD1AAE75DC0052ABE6 /* TableView.xib in Resources */,
DD0870091AB0F1B0002F0297 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -277,6 +285,19 @@
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
DD08700B1AB0F1B0002F0297 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
DD08700A1AB0F1B0002F0297 /* en */,
DD08700C1AB0F1C2002F0297 /* pt */,
DD08700E1AB1AE46002F0297 /* fr */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
92C21CD11AAE757A0052ABE6 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down
1 change: 1 addition & 0 deletions iTunesSearch/Entidades/Filme.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
@property (nonatomic, strong) NSString *duracao;
@property (nonatomic, strong) NSString *genero;
@property (nonatomic, strong) NSString *pais;
@property (nonatomic,strong) NSString *midia;

@end
10 changes: 8 additions & 2 deletions iTunesSearch/TableView.xib
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6751" systemVersion="14D72i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TableViewController">
<connections>
<outlet property="search" destination="zc7-CN-XMX" id="TA0-Tu-uUp"/>
<outlet property="tableview" destination="z24-IP-C1d" id="fiF-7d-ri3"/>
<outlet property="view" destination="z24-IP-C1d" id="NXu-VO-9o4"/>
</connections>
Expand All @@ -15,11 +16,16 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<searchBar key="tableHeaderView" contentMode="redraw" id="zc7-CN-XMX">
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<textInputTraits key="textInputTraits"/>
</searchBar>
<connections>
<outlet property="dataSource" destination="-1" id="grn-Rq-4Ux"/>
<outlet property="delegate" destination="-1" id="M2x-yu-OMO"/>
</connections>
<point key="canvasLocation" x="-135" y="440"/>
<point key="canvasLocation" x="-96" y="406"/>
</tableView>
</objects>
</document>
2 changes: 2 additions & 0 deletions iTunesSearch/TableViewCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

@property (weak, nonatomic) IBOutlet UILabel *nome;
@property (weak, nonatomic) IBOutlet UILabel *tipo;
@property (weak, nonatomic) IBOutlet UILabel *genero;
@property (weak, nonatomic) IBOutlet UILabel *duracao;


@end
37 changes: 30 additions & 7 deletions iTunesSearch/TableViewCell.xib
Original file line number Diff line number Diff line change
@@ -1,46 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6751" systemVersion="14D72i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6751" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="75" id="KGk-i7-Jjw" customClass="TableViewCell">
<rect key="frame" x="0.0" y="0.0" width="300" height="65"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="141" id="KGk-i7-Jjw" customClass="TableViewCell">
<rect key="frame" x="0.0" y="0.0" width="300" height="131"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Nome da Mídia" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UIA-JU-luV">
<rect key="frame" x="8" y="8" width="284" height="21"/>
<rect key="frame" x="8" y="8" width="284" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Tipo da Mídia" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6Z5-yj-wnl">
<rect key="frame" x="8" y="34" width="284" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Tipo da Mídia" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6Z5-yj-wnl">
<rect key="frame" x="8" y="34" width="137" height="14"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="12"/>
<color key="textColor" red="0.89928382640000004" green="0.12798005339999999" blue="0.001599563868" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="genero" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bwH-QX-Ck4">
<rect key="frame" x="165" y="100" width="127" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="duracao" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tqk-yn-JzH">
<rect key="frame" x="165" y="71" width="63" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="6Z5-yj-wnl" secondAttribute="trailing" id="20H-3b-RZ8"/>
<constraint firstAttribute="trailingMargin" secondItem="bwH-QX-Ck4" secondAttribute="trailing" id="7NW-mX-ttV"/>
<constraint firstItem="bwH-QX-Ck4" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="157" id="8JU-KX-05E"/>
<constraint firstItem="6Z5-yj-wnl" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="96O-aR-ps1"/>
<constraint firstItem="UIA-JU-luV" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="Q1V-YW-Wh5"/>
<constraint firstItem="bwH-QX-Ck4" firstAttribute="leading" secondItem="6Z5-yj-wnl" secondAttribute="trailing" constant="20" id="Sw5-y9-23o"/>
<constraint firstItem="UIA-JU-luV" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="YdC-rX-aV6"/>
<constraint firstAttribute="trailingMargin" secondItem="UIA-JU-luV" secondAttribute="trailing" id="cTH-Nq-14q"/>
<constraint firstAttribute="bottomMargin" secondItem="bwH-QX-Ck4" secondAttribute="bottom" constant="1.5" id="ltF-yB-7nB"/>
<constraint firstItem="6Z5-yj-wnl" firstAttribute="top" secondItem="UIA-JU-luV" secondAttribute="bottom" constant="5" id="tJH-0d-wda"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="20H-3b-RZ8"/>
</mask>
</variation>
</tableViewCellContentView>
<connections>
<outlet property="duracao" destination="tqk-yn-JzH" id="s5M-GO-r0f"/>
<outlet property="genero" destination="bwH-QX-Ck4" id="Wo4-rA-DMP"/>
<outlet property="nome" destination="UIA-JU-luV" id="ubX-WX-gam"/>
<outlet property="tipo" destination="6Z5-yj-wnl" id="vYj-HE-tLd"/>
</connections>
<point key="canvasLocation" x="577" y="80.5"/>
<point key="canvasLocation" x="299" y="76.5"/>
</tableViewCell>
</objects>
</document>
6 changes: 4 additions & 2 deletions iTunesSearch/TableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

#import <UIKit/UIKit.h>

@interface TableViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>

@interface TableViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate>

@property (strong, nonatomic) IBOutlet UITableView *tableview;

@property (weak, nonatomic) IBOutlet UISearchBar *search;


@end

48 changes: 38 additions & 10 deletions iTunesSearch/TableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#import "Entidades/Filme.h"

@interface TableViewController () {
NSArray *midias;
NSMutableArray *midias;
}

@end
Expand All @@ -24,14 +24,17 @@ @implementation TableViewController
- (void)viewDidLoad {
[super viewDidLoad];

UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:nil];
[self.tableview registerNib:nib forCellReuseIdentifier:@"celulaPadrao"];
UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:nil];
[self.tableview registerNib:nib forCellReuseIdentifier:@"celulaPadrao"];

[iTunesManager sharedInstance];

[self.search setDelegate:self];
self.search.placeholder = NSLocalizedString(@"pesquisar", nil);

iTunesManager *itunes = [iTunesManager sharedInstance];
midias = [itunes buscarMidias:@"Apple"];

#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)];
//self.tableview.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 15.f)];
}

- (void)didReceiveMemoryWarning {
Expand All @@ -52,17 +55,42 @@ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
TableViewCell *celula = [self.tableview dequeueReusableCellWithIdentifier:@"celulaPadrao"];

Filme *filme = [midias objectAtIndex:indexPath.row];
Filme *asMidias = [midias objectAtIndex:indexPath.row];

[celula.nome setText:asMidias.nome];
[celula.tipo setText:asMidias.midia];
[celula.genero setText:asMidias.genero];
[celula.duracao setText:[NSString stringWithFormat:@"%@",asMidias.duracao]];



[celula.nome setText:filme.nome];
[celula.tipo setText:@"Filme"];

return celula;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 70;
return 130;
}



- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{

iTunesManager *itunes = [iTunesManager sharedInstance];
midias = [[NSMutableArray alloc] init];
// NSArray *movie = [itunes buscarMidias:(_search.text) andMedia:@"movie"];
// NSArray *ebook = [itunes buscarMidias:(_search.text) andMedia:@"ebook"];
// NSArray *podcast = [itunes buscarMidias:(_search.text) andMedia: @"podcast" ];
// NSArray *music = [itunes buscarMidias:(_search.text) andMedia:@"music"];
[midias addObjectsFromArray:[itunes buscarMidias:(_search.text) andMedia:@"movie"]];
[midias addObjectsFromArray:[itunes buscarMidias:(_search.text) andMedia:@"ebook"]];
[midias addObjectsFromArray:[itunes buscarMidias:(_search.text) andMedia: @"podcast" ]];
[midias addObjectsFromArray:[itunes buscarMidias:(_search.text) andMedia:@"music"]];


[self.search resignFirstResponder];
[self.tableview reloadData];

}
@end
10 changes: 10 additions & 0 deletions iTunesSearch/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
Localzable.strings
iTunesSearch

Created by Matheus Amancio Seixeiro on 3/11/15.
Copyright (c) 2015 joaquim. All rights reserved.
*/


"pesquisar" ="search";
10 changes: 10 additions & 0 deletions iTunesSearch/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
Localzable.strings
iTunesSearch

Created by Matheus Amancio Seixeiro on 3/11/15.
Copyright (c) 2015 joaquim. All rights reserved.
*/


"pesquisar" ="Testetstetstes xablau";
3 changes: 2 additions & 1 deletion iTunesSearch/iTunesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface iTunesManager : NSObject

Expand All @@ -16,6 +17,6 @@
*/
+ (iTunesManager*)sharedInstance;

- (NSArray *)buscarMidias:(NSString *)termo;
- (NSArray *)buscarMidias:(NSString *)termo andMedia:(NSString*)media;

@end
Loading