films tab has correct information on it
This commit is contained in:
@@ -149,16 +149,16 @@
|
||||
<scene sceneID="CX5-hP-Yrk">
|
||||
<objects>
|
||||
<tableViewController id="OwN-NY-lQV" customClass="FESVenuesTableViewController" sceneMemberID="viewController">
|
||||
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="88" sectionHeaderHeight="22" sectionFooterHeight="22" id="fiy-kO-qOW">
|
||||
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="111" sectionHeaderHeight="22" sectionFooterHeight="22" id="fiy-kO-qOW">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="venueEntryCell" rowHeight="88" id="pRA-XH-MNZ" customClass="FESVenueEntryCell">
|
||||
<rect key="frame" x="0.0" y="86" width="320" height="88"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="venueEntryCell" rowHeight="111" id="pRA-XH-MNZ" customClass="FESVenueEntryCell">
|
||||
<rect key="frame" x="0.0" y="86" width="320" height="111"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="pRA-XH-MNZ" id="8Lb-ac-tEa">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="87"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="110"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Summer Theatre HT Eronet" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="r39-y9-TCo">
|
||||
@@ -168,13 +168,13 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Gimnazijska bb" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LMT-fD-pgR">
|
||||
<rect key="frame" x="20" y="49" width="217" height="21"/>
|
||||
<rect key="frame" x="20" y="49" width="280" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="3.000" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P0F-Kj-f6N">
|
||||
<rect key="frame" x="257" y="49" width="43" height="21"/>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="3.000" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P0F-Kj-f6N">
|
||||
<rect key="frame" x="20" y="78" width="280" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -183,8 +183,12 @@
|
||||
<constraints>
|
||||
<constraint firstItem="P0F-Kj-f6N" firstAttribute="leading" secondItem="LMT-fD-pgR" secondAttribute="trailing" constant="20" id="259-5g-8ST"/>
|
||||
<constraint firstItem="LMT-fD-pgR" firstAttribute="leading" secondItem="8Lb-ac-tEa" secondAttribute="leading" constant="20" id="Auk-fz-VIf"/>
|
||||
<constraint firstItem="P0F-Kj-f6N" firstAttribute="leading" secondItem="8Lb-ac-tEa" secondAttribute="leading" constant="20" id="B2c-Qd-MzK"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="P0F-Kj-f6N" secondAttribute="trailing" constant="20" id="DPF-fI-cyS"/>
|
||||
<constraint firstAttribute="trailing" secondItem="r39-y9-TCo" secondAttribute="trailing" constant="20" id="NPk-Wf-nvl"/>
|
||||
<constraint firstItem="LMT-fD-pgR" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="8Lb-ac-tEa" secondAttribute="leading" constant="20" id="PXd-c0-Y2l"/>
|
||||
<constraint firstAttribute="trailing" secondItem="P0F-Kj-f6N" secondAttribute="trailing" constant="20" id="Zux-mN-h5D"/>
|
||||
<constraint firstAttribute="trailing" secondItem="LMT-fD-pgR" secondAttribute="trailing" constant="20" id="b3m-zr-5S8"/>
|
||||
<constraint firstItem="r39-y9-TCo" firstAttribute="leading" secondItem="8Lb-ac-tEa" secondAttribute="leading" constant="20" id="t43-fZ-5TG"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
@@ -206,22 +210,56 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1333" y="670"/>
|
||||
</scene>
|
||||
<!--Table View Controller - Root View Controller-->
|
||||
<!--Films Table View Controller - Root View Controller-->
|
||||
<scene sceneID="jeb-R4-g0i">
|
||||
<objects>
|
||||
<tableViewController id="LXN-2J-5ue" sceneMemberID="viewController">
|
||||
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="Y3o-Zo-KT8">
|
||||
<tableViewController id="LXN-2J-5ue" customClass="FESFilmsTableViewController" sceneMemberID="viewController">
|
||||
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="88" sectionHeaderHeight="22" sectionFooterHeight="22" id="Y3o-Zo-KT8">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="MAk-6d-avF">
|
||||
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="filmEntryCell" rowHeight="88" id="MAk-6d-avF" customClass="FESFilmEntryCell">
|
||||
<rect key="frame" x="0.0" y="86" width="320" height="88"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="MAk-6d-avF" id="7xo-gI-Zhq">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="87"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Title of a film" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BaY-d4-OAI">
|
||||
<rect key="frame" x="20" y="20" width="280" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="2014" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dL4-pC-EIK">
|
||||
<rect key="frame" x="20" y="49" width="39" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="Emir Bukva, Senad Uka" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gjd-f3-4U7">
|
||||
<rect key="frame" x="67" y="49" width="233" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="dL4-pC-EIK" firstAttribute="leading" secondItem="7xo-gI-Zhq" secondAttribute="leading" constant="20" id="BJE-aD-sS0"/>
|
||||
<constraint firstItem="BaY-d4-OAI" firstAttribute="leading" secondItem="7xo-gI-Zhq" secondAttribute="leading" constant="20" id="Jjd-zX-fFH"/>
|
||||
<constraint firstAttribute="trailing" secondItem="gjd-f3-4U7" secondAttribute="trailing" constant="20" id="M1T-7V-TM4"/>
|
||||
<constraint firstItem="gjd-f3-4U7" firstAttribute="leading" secondItem="dL4-pC-EIK" secondAttribute="trailing" constant="8" id="bMk-XL-5LR"/>
|
||||
<constraint firstItem="gjd-f3-4U7" firstAttribute="leading" secondItem="dL4-pC-EIK" secondAttribute="trailing" constant="8" id="e6w-3J-UaJ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="BaY-d4-OAI" secondAttribute="trailing" constant="20" id="sod-Ry-DMr"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="filmDirectors" destination="gjd-f3-4U7" id="mtt-Vk-sd4"/>
|
||||
<outlet property="filmTitle" destination="BaY-d4-OAI" id="XHB-fM-7TT"/>
|
||||
<outlet property="filmYear" destination="dL4-pC-EIK" id="9eg-wX-qi4"/>
|
||||
<segue destination="vha-UC-aYM" kind="push" id="HvR-cB-zbc"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<connections>
|
||||
@@ -235,6 +273,43 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1324" y="1412"/>
|
||||
</scene>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="saQ-da-PLe">
|
||||
<objects>
|
||||
<viewController id="vha-UC-aYM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="aJQ-ad-BPG"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="0bj-VB-Pw3"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="911-Ey-uHV">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="Love's a Bitch" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nbY-Gm-QpS">
|
||||
<rect key="frame" x="20" y="84" width="280" height="45"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="30"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="(Amore's Perros)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Zv-99-TJq">
|
||||
<rect key="frame" x="20" y="137" width="280" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="30"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="nbY-Gm-QpS" secondAttribute="trailing" constant="20" id="dYO-P3-f5J"/>
|
||||
<constraint firstItem="nbY-Gm-QpS" firstAttribute="leading" secondItem="911-Ey-uHV" secondAttribute="leading" constant="20" id="wdg-ex-XuY"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="5vS-ss-2iU"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="6qR-Jm-V7B" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1769" y="1412"/>
|
||||
</scene>
|
||||
<!--Navigation Controller - Films-->
|
||||
<scene sceneID="AJa-iV-8JL">
|
||||
<objects>
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
#if(URL_LOCAL==1)
|
||||
#define SCHEDULE_URL @"http://127.0.0.1:8080/sff2014/schedule.json?local"
|
||||
#define VENUES_URL @"http://127.0.0.1:8080/sff2014/venues.json?local"
|
||||
#define FILMS_URL @"http://127.0.0.1:8080/sff2014/films.json?local"
|
||||
#else
|
||||
#define SCHEDULE_URL @"http://localhost:8080/sff2014/schedule.json?remote"
|
||||
#define VENUES_URL @"http://localhost:8080/sff2014/venues.json?remote"
|
||||
#define FILMS_URL @"http://localhost:8080/sff2014/films.json?remote"
|
||||
#endif
|
||||
|
||||
26
FestivalHelper/films/FESFilmEntry.h
Normal file
26
FestivalHelper/films/FESFilmEntry.h
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// FESFilmEntry.h
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 06/09/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface FESFilmEntry : NSObject
|
||||
|
||||
@property (assign) NSInteger filmId;
|
||||
@property (strong) NSString *filmTitle;
|
||||
@property (strong) NSString *filmTitleTranslation;
|
||||
@property (strong) NSString *filmProgram;
|
||||
@property (strong) NSString *filmDate;
|
||||
@property (strong) NSString *filmTime;
|
||||
@property (strong) NSString *filmYear;
|
||||
@property (strong) NSString *filmDescription;
|
||||
@property (strong) NSString *filmDirectors;
|
||||
@property (strong) NSString *filmTagLines;
|
||||
|
||||
-(id)initWithJSONData:(NSDictionary*)filmData;
|
||||
|
||||
@end
|
||||
44
FestivalHelper/films/FESFilmEntry.m
Normal file
44
FestivalHelper/films/FESFilmEntry.m
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// FESFilmEntry.m
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 06/09/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FESFilmEntry.h"
|
||||
|
||||
@implementation FESFilmEntry
|
||||
|
||||
@synthesize filmId;
|
||||
@synthesize filmDate;
|
||||
@synthesize filmDescription;
|
||||
@synthesize filmDirectors;
|
||||
@synthesize filmProgram;
|
||||
@synthesize filmTagLines;
|
||||
@synthesize filmTime;
|
||||
@synthesize filmTitle;
|
||||
@synthesize filmTitleTranslation;
|
||||
@synthesize filmYear;
|
||||
|
||||
|
||||
-(id)initWithJSONData:(NSDictionary*)filmData{
|
||||
self = [super init];
|
||||
if(self){
|
||||
//NSLog(@"initWithJSONData method called");
|
||||
self.filmId = [[filmData objectForKey:@"id"] integerValue];
|
||||
self.filmTitle = [filmData objectForKey:@"title"];
|
||||
self.filmTitleTranslation = [filmData objectForKey:@"titleTranslation"];
|
||||
self.filmYear = [filmData objectForKey:@"year"];
|
||||
self.filmDate = [filmData objectForKey:@"date"];
|
||||
self.filmTime = [filmData objectForKey:@"time"];
|
||||
self.filmTagLines = [filmData objectForKey:@"tagLine"];
|
||||
self.filmDescription = [filmData objectForKey:@"description"];
|
||||
self.filmDirectors = [filmData objectForKey:@"directors"];
|
||||
self.filmProgram = [filmData objectForKey:@"program"];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
19
FestivalHelper/films/FESFilmEntryCell.h
Normal file
19
FestivalHelper/films/FESFilmEntryCell.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// FESFilmEntryCell.h
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 06/09/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface FESFilmEntryCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic)IBOutlet UILabel *filmTitle;
|
||||
@property (weak, nonatomic)IBOutlet UILabel *filmYear;
|
||||
@property (weak, nonatomic)IBOutlet UILabel *filmDirectors;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
40
FestivalHelper/films/FESFilmEntryCell.m
Normal file
40
FestivalHelper/films/FESFilmEntryCell.m
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// FESFilmEntryCell.m
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 06/09/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FESFilmEntryCell.h"
|
||||
|
||||
@implementation FESFilmEntryCell
|
||||
|
||||
|
||||
@synthesize filmDirectors;
|
||||
@synthesize filmTitle;
|
||||
@synthesize filmYear;
|
||||
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
// Initialization code
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
|
||||
{
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
15
FestivalHelper/films/FESFilmsTableViewController.h
Normal file
15
FestivalHelper/films/FESFilmsTableViewController.h
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// FESFilmsTableViewController.h
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 06/09/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface FESFilmsTableViewController : UITableViewController
|
||||
|
||||
@property (strong)NSMutableArray *filmsArray;
|
||||
|
||||
@end
|
||||
147
FestivalHelper/films/FESFilmsTableViewController.m
Normal file
147
FestivalHelper/films/FESFilmsTableViewController.m
Normal file
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// FESFilmsTableViewController.m
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 06/09/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FESFilmsTableViewController.h"
|
||||
#import "FESFilmEntry.h"
|
||||
#import "FESDataProvider.h"
|
||||
#import "FESFilmEntryCell.h"
|
||||
|
||||
@interface FESFilmsTableViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation FESFilmsTableViewController
|
||||
|
||||
@synthesize filmsArray;
|
||||
|
||||
- (id)initWithStyle:(UITableViewStyle)style
|
||||
{
|
||||
self = [super initWithStyle:style];
|
||||
if (self) {
|
||||
// Custom initialization
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
[FESDataProvider getDataFromServerForUrl:FILMS_URL andProcessThemWith:^(NSData *data) {
|
||||
[self setupFilmsFromJSONArray:data];
|
||||
[self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(void)setupFilmsFromJSONArray:(NSData*)dataFromServerArray{
|
||||
NSError *error;
|
||||
self.filmsArray = [[NSMutableArray alloc] init];
|
||||
NSArray *arrayFromServer = [NSJSONSerialization JSONObjectWithData:dataFromServerArray options:0 error:&error];
|
||||
|
||||
if(error){
|
||||
NSLog(@"error parsing the json data from server with error description - %@", [error localizedDescription]);
|
||||
}
|
||||
else {
|
||||
self.filmsArray = [[NSMutableArray alloc] init];
|
||||
for(NSDictionary *filmData in arrayFromServer)
|
||||
{
|
||||
FESFilmEntry *entry = [[FESFilmEntry alloc] initWithJSONData:filmData];
|
||||
[self.filmsArray addObject:entry];
|
||||
}
|
||||
NSLog(@"success!");
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning
|
||||
{
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
#pragma mark - Table view data source
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
// Return the number of sections.
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
// Return the number of rows in the section.
|
||||
return [filmsArray count];
|
||||
}
|
||||
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UITableViewCell *retrievedCell = [tableView dequeueReusableCellWithIdentifier:@"filmEntryCell" forIndexPath:indexPath];
|
||||
FESFilmEntryCell *cell = (FESFilmEntryCell *)retrievedCell;
|
||||
FESFilmEntry *film = [filmsArray objectAtIndex:indexPath.row];
|
||||
|
||||
cell.filmDirectors.text = film.filmDirectors;
|
||||
cell.filmTitle.text = film.filmTitle;
|
||||
cell.filmYear.text = film.filmYear;
|
||||
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// Override to support conditional editing of the table view.
|
||||
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
// Return NO if you do not want the specified item to be editable.
|
||||
return YES;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Override to support editing the table view.
|
||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
||||
// Delete the row from the data source
|
||||
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
||||
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
||||
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Override to support rearranging the table view.
|
||||
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Override to support conditional rearranging of the table view.
|
||||
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
// Return NO if you do not want the item to be re-orderable.
|
||||
return YES;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
#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
|
||||
@@ -33,7 +33,7 @@
|
||||
[super viewDidLoad];
|
||||
|
||||
[FESDataProvider getDataFromServerForUrl:VENUES_URL andProcessThemWith:^(NSData *data) {
|
||||
[self setupScheduleFromJSONArray:data];
|
||||
[self setupVenuesFromJSONArray:data];
|
||||
[self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
|
||||
}];
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
}
|
||||
|
||||
|
||||
-(void)setupScheduleFromJSONArray:(NSData*)dataFromServerArray{
|
||||
-(void)setupVenuesFromJSONArray:(NSData*)dataFromServerArray{
|
||||
NSError *error;
|
||||
self.venuesArray = [[NSMutableArray alloc] init];
|
||||
NSArray *arrayFromServer = [NSJSONSerialization JSONObjectWithData:dataFromServerArray options:0 error:&error];
|
||||
|
||||
Reference in New Issue
Block a user