first screen (schedule) now has the right information
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
3068700719B2D6B1007E4A0E /* FESSCheduleEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 3068700619B2D6B1007E4A0E /* FESSCheduleEntry.m */; };
|
||||
3068700A19B2F826007E4A0E /* FESScheduleFilm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3068700919B2F826007E4A0E /* FESScheduleFilm.m */; };
|
||||
3068700D19B5AB16007E4A0E /* FESScheduleTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3068700C19B5AB16007E4A0E /* FESScheduleTableViewController.m */; };
|
||||
3068701319B6301C007E4A0E /* FESScheduleEntryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3068701219B6301C007E4A0E /* FESScheduleEntryCell.m */; };
|
||||
3CEA73BD19B1A86D00076FC5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CEA73BC19B1A86C00076FC5 /* Foundation.framework */; };
|
||||
3CEA73BF19B1A86D00076FC5 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CEA73BE19B1A86D00076FC5 /* CoreGraphics.framework */; };
|
||||
3CEA73C119B1A86D00076FC5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CEA73C019B1A86D00076FC5 /* UIKit.framework */; };
|
||||
@@ -39,6 +41,10 @@
|
||||
3068700619B2D6B1007E4A0E /* FESSCheduleEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FESSCheduleEntry.m; path = schedule/FESSCheduleEntry.m; sourceTree = "<group>"; };
|
||||
3068700819B2F826007E4A0E /* FESScheduleFilm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FESScheduleFilm.h; path = schedule/FESScheduleFilm.h; sourceTree = "<group>"; };
|
||||
3068700919B2F826007E4A0E /* FESScheduleFilm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FESScheduleFilm.m; path = schedule/FESScheduleFilm.m; sourceTree = "<group>"; };
|
||||
3068700B19B5AB16007E4A0E /* FESScheduleTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FESScheduleTableViewController.h; path = schedule/FESScheduleTableViewController.h; sourceTree = "<group>"; };
|
||||
3068700C19B5AB16007E4A0E /* FESScheduleTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FESScheduleTableViewController.m; path = schedule/FESScheduleTableViewController.m; sourceTree = "<group>"; };
|
||||
3068701119B6301C007E4A0E /* FESScheduleEntryCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FESScheduleEntryCell.h; path = schedule/FESScheduleEntryCell.h; sourceTree = "<group>"; };
|
||||
3068701219B6301C007E4A0E /* FESScheduleEntryCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FESScheduleEntryCell.m; path = schedule/FESScheduleEntryCell.m; sourceTree = "<group>"; };
|
||||
3CEA73B919B1A86C00076FC5 /* FestivalHelper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FestivalHelper.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3CEA73BC19B1A86C00076FC5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
3CEA73BE19B1A86D00076FC5 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||
@@ -89,6 +95,10 @@
|
||||
3068700619B2D6B1007E4A0E /* FESSCheduleEntry.m */,
|
||||
3068700819B2F826007E4A0E /* FESScheduleFilm.h */,
|
||||
3068700919B2F826007E4A0E /* FESScheduleFilm.m */,
|
||||
3068700B19B5AB16007E4A0E /* FESScheduleTableViewController.h */,
|
||||
3068700C19B5AB16007E4A0E /* FESScheduleTableViewController.m */,
|
||||
3068701119B6301C007E4A0E /* FESScheduleEntryCell.h */,
|
||||
3068701219B6301C007E4A0E /* FESScheduleEntryCell.m */,
|
||||
);
|
||||
name = schedule;
|
||||
sourceTree = "<group>";
|
||||
@@ -263,7 +273,9 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3068700D19B5AB16007E4A0E /* FESScheduleTableViewController.m in Sources */,
|
||||
3CEA73C919B1A86D00076FC5 /* main.m in Sources */,
|
||||
3068701319B6301C007E4A0E /* FESScheduleEntryCell.m in Sources */,
|
||||
3068700719B2D6B1007E4A0E /* FESSCheduleEntry.m in Sources */,
|
||||
3CEA73CD19B1A86D00076FC5 /* FESAppDelegate.m in Sources */,
|
||||
3068700A19B2F826007E4A0E /* FESScheduleFilm.m in Sources */,
|
||||
@@ -394,6 +406,11 @@
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "FestivalHelper/FestivalHelper-Prefix.pch";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"LOCAL_URL=1",
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = "FestivalHelper/FestivalHelper-Info.plist";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
@@ -408,6 +425,7 @@
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "FestivalHelper/FestivalHelper-Prefix.pch";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "LOCAL_URL=0";
|
||||
INFOPLIST_FILE = "FestivalHelper/FestivalHelper-Info.plist";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
<Breakpoints>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "FestivalHelper/schedule/FESScheduleTableViewController.m"
|
||||
timestampString = "431372782.77244"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "97"
|
||||
endingLineNumber = "97"
|
||||
landmarkName = "-setupScheduleFromJSONArray:"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "FestivalHelper/schedule/FESScheduleTableViewController.m"
|
||||
timestampString = "431372782.77244"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "74"
|
||||
endingLineNumber = "74"
|
||||
landmarkName = "-getScheduleDataFromServer"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "FestivalHelper/schedule/FESScheduleTableViewController.m"
|
||||
timestampString = "431372782.77244"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "86"
|
||||
endingLineNumber = "86"
|
||||
landmarkName = "-setupScheduleFromJSONArray:"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "FestivalHelper/schedule/FESScheduleTableViewController.m"
|
||||
timestampString = "431372782.77244"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "100"
|
||||
endingLineNumber = "100"
|
||||
landmarkName = "-setupScheduleFromJSONArray:"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "FestivalHelper/schedule/FESScheduleTableViewController.m"
|
||||
timestampString = "431372782.77244"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "98"
|
||||
endingLineNumber = "98"
|
||||
landmarkName = "-setupScheduleFromJSONArray:"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
@@ -25,34 +25,82 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="132" y="180"/>
|
||||
</scene>
|
||||
<!--Table View Controller - Root View Controller-->
|
||||
<!--Schedule Table View Controller - 2014-->
|
||||
<scene sceneID="Gwb-IZ-cXq">
|
||||
<objects>
|
||||
<tableViewController id="aNc-F9-0cW" sceneMemberID="viewController">
|
||||
<tableViewController id="aNc-F9-0cW" customClass="FESScheduleTableViewController" 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="HpO-cG-BkW">
|
||||
<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="g68-Qd-9Ij">
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="scheduleEntryCell" id="g68-Qd-9Ij" customClass="FESScheduleEntryCell">
|
||||
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="g68-Qd-9Ij" id="6f9-Rs-ptT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Fri" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hgY-f8-EeZ">
|
||||
<rect key="frame" x="20" y="11" width="42" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="15. August" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CXi-kA-ow8">
|
||||
<rect key="frame" x="70" y="11" width="83" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="scheduleDate" destination="CXi-kA-ow8" id="4wi-Xj-rhe"/>
|
||||
<outlet property="scheduleDayOfWeek" destination="hgY-f8-EeZ" id="bVi-Sl-f8D"/>
|
||||
<segue destination="0t7-N6-wZY" kind="push" id="WWo-rm-Zb3"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="aNc-F9-0cW" id="B8w-3G-bqo"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="2014" id="oPc-a0-wbv"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="4Vp-c3-FnG" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1333" y="-242"/>
|
||||
</scene>
|
||||
<!--Table View Controller-->
|
||||
<scene sceneID="2yk-lz-VwC">
|
||||
<objects>
|
||||
<tableViewController id="0t7-N6-wZY" 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="as4-4p-NwJ">
|
||||
<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="NlW-xg-4gy">
|
||||
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="NlW-xg-4gy" id="qGp-By-vBv">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="aNc-F9-0cW" id="B8w-3G-bqo"/>
|
||||
<outlet property="delegate" destination="aNc-F9-0cW" id="rxE-QR-e9r"/>
|
||||
<outlet property="dataSource" destination="0t7-N6-wZY" id="v20-t2-JHd"/>
|
||||
<outlet property="delegate" destination="0t7-N6-wZY" id="bdD-jF-UpC"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Root View Controller" id="oPc-a0-wbv"/>
|
||||
<navigationItem key="navigationItem" id="zkS-4H-eLi"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="4Vp-c3-FnG" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="2Po-QA-1an" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1333" y="-242"/>
|
||||
<point key="canvasLocation" x="1894" y="-235"/>
|
||||
</scene>
|
||||
<!--Table View Controller - Root View Controller-->
|
||||
<scene sceneID="CX5-hP-Yrk">
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -14,3 +14,9 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#if(URL_LOCAL==1)
|
||||
#define SCHEDULE_URL @"http://127.0.0.1:8080/sff2014/schedule.json"
|
||||
#else
|
||||
#define SCHEDULE_URL @"http://localhost:8080/sff2014/schedule.json"
|
||||
#endif
|
||||
|
||||
17
FestivalHelper/schedule/FESScheduleEntryCell.h
Normal file
17
FestivalHelper/schedule/FESScheduleEntryCell.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// FESScheduleEntryCell.h
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 02/09/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface FESScheduleEntryCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic)IBOutlet UILabel *scheduleDayOfWeek;
|
||||
@property (weak, nonatomic)IBOutlet UILabel *scheduleDate;
|
||||
|
||||
|
||||
@end
|
||||
34
FestivalHelper/schedule/FESScheduleEntryCell.m
Normal file
34
FestivalHelper/schedule/FESScheduleEntryCell.m
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// FESScheduleEntryCell.m
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 02/09/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FESScheduleEntryCell.h"
|
||||
|
||||
@implementation FESScheduleEntryCell
|
||||
|
||||
- (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/schedule/FESScheduleTableViewController.h
Normal file
15
FestivalHelper/schedule/FESScheduleTableViewController.h
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// FESScheduleTableViewController.h
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 02/09/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface FESScheduleTableViewController : UITableViewController
|
||||
|
||||
@property (strong)NSMutableArray *scheduleArray;
|
||||
|
||||
@end
|
||||
173
FestivalHelper/schedule/FESScheduleTableViewController.m
Normal file
173
FestivalHelper/schedule/FESScheduleTableViewController.m
Normal file
@@ -0,0 +1,173 @@
|
||||
//
|
||||
// FESScheduleTableViewController.m
|
||||
// FestivalHelper
|
||||
//
|
||||
// Created by Hamo Hapic on 02/09/14.
|
||||
// Copyright (c) 2014 Senad Uka. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FESScheduleTableViewController.h"
|
||||
#import "FESSCheduleEntry.h"
|
||||
#import "FESScheduleEntryCell.h"
|
||||
|
||||
@interface FESScheduleTableViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation FESScheduleTableViewController
|
||||
|
||||
@synthesize scheduleArray;
|
||||
|
||||
|
||||
- (id)initWithStyle:(UITableViewStyle)style
|
||||
{
|
||||
self = [super initWithStyle:style];
|
||||
if (self) {
|
||||
// Custom initialization
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
[self getScheduleDataFromServer];
|
||||
|
||||
// Uncomment the following line to preserve selection between presentations.
|
||||
// self.clearsSelectionOnViewWillAppear = NO;
|
||||
|
||||
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
|
||||
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning
|
||||
{
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
#pragma mark - Table view data source
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
// Return the number of rows in the section.
|
||||
return [self.scheduleArray count];
|
||||
}
|
||||
|
||||
-(void)getScheduleDataFromServer {
|
||||
|
||||
NSLog(@"Getting data");
|
||||
|
||||
NSURL *url = [[NSURL alloc] initWithString:SCHEDULE_URL];
|
||||
[NSURLConnection sendAsynchronousRequest:[[NSURLRequest alloc] initWithURL:url] queue:[[NSOperationQueue alloc] init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
|
||||
if(connectionError) {
|
||||
NSLog(@"Error getting %@ schedule data: - %@", SCHEDULE_URL, [connectionError localizedDescription]);
|
||||
}
|
||||
else {
|
||||
NSLog(@"Parsing data.");
|
||||
[self setupScheduleFromJSONArray:data];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(void)setupScheduleFromJSONArray:(NSData*)dataFromServerArray{
|
||||
NSError *error;
|
||||
self.scheduleArray = [[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.scheduleArray = [[NSMutableArray alloc] init];
|
||||
for(NSDictionary *scheduleData in arrayFromServer)
|
||||
{
|
||||
FESSCheduleEntry *entry = [[FESSCheduleEntry alloc] initWithJSONData:scheduleData];
|
||||
[self.scheduleArray addObject:entry];
|
||||
}
|
||||
NSLog(@"success!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UITableViewCell *retrievedCell = [tableView dequeueReusableCellWithIdentifier:@"scheduleEntryCell" forIndexPath:indexPath];
|
||||
FESScheduleEntryCell *cell = (FESScheduleEntryCell *)retrievedCell;
|
||||
|
||||
if(cell)
|
||||
{
|
||||
|
||||
//The beauty of this is that you have all your data in one object and grab WHATEVER you like
|
||||
//This way in the future you can add another field without doing much.
|
||||
FESSCheduleEntry *scheduleEntry = [scheduleArray objectAtIndex:indexPath.row];
|
||||
cell.scheduleDate.text = [scheduleEntry scheduleDate];
|
||||
cell.scheduleDayOfWeek.text = [scheduleEntry scheduleDayOfWeek];
|
||||
}
|
||||
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
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"id": 1,
|
||||
"dayOfWeek": "Fri",
|
||||
"date": "15. Aug",
|
||||
"date": "15. August",
|
||||
"year": "2014",
|
||||
"films": [
|
||||
{
|
||||
@@ -13,6 +13,21 @@
|
||||
"duration": "154'"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"dayOfWeek": "Sat",
|
||||
"date": "16. August",
|
||||
"year": "2014",
|
||||
"films": [
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Go go power rangers!",
|
||||
"venue": "Summer Theatre HT Eronet",
|
||||
"time": "20:31",
|
||||
"duration": "166'"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user