Permalink
Browse files

Messing up everything to build something better (for the future)

  • Loading branch information...
1 parent ccab0bf commit f0367aed68064fbb7b7601f47d63ef2e283b6614 Frederic Jacobs committed Dec 14, 2011
View
BIN .DS_Store
Binary file not shown.
View
@@ -94,7 +94,7 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUINavigationItem" key="IBUINavigationItem" id="636803895">
- <string key="IBUITitle">Item</string>
+ <string key="IBUITitle">All Shows</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIParentViewController" ref="102085146"/>
@@ -134,7 +134,6 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{0, 431}, {320, 49}}</string>
<reference key="NSSuperview"/>
- <reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:473</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
@@ -174,7 +173,7 @@
<reference key="source" ref="117978783"/>
<reference key="destination" ref="170853733"/>
</object>
- <int key="connectionID">37</int>
+ <int key="connectionID">52</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
@@ -192,6 +191,14 @@
</object>
<int key="connectionID">49</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="170853733"/>
+ <reference key="destination" ref="1013181473"/>
+ </object>
+ <int key="connectionID">50</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -360,7 +367,7 @@
<reference key="dict.values" ref="957960031"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">49</int>
+ <int key="maxID">52</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
View
@@ -7,23 +7,19 @@
//
#import <UIKit/UIKit.h>
-#import "ShowRSSParser.h"
+#import "Show.h"
@class DetailController;
-@interface SecondViewController : UITableViewController<ShowRSSParserDelegate>{
+@interface SecondViewController : UITableViewController{
IBOutlet UITableView *allShows;
- ShowRSSParser *myParser;
NSMutableArray *shows;
DetailController *detailController;
}
-@property (nonatomic, retain) NSMutableArray *shows;
-@property (nonatomic, retain) ShowRSSParser *myParser;
@property (nonatomic, retain, readonly) DetailController *detailController;
-
-- (id) init;
+@property (nonatomic, retain) NSMutableArray *shows;
@end
View
@@ -7,14 +7,11 @@
//
#import "SecondViewController.h"
-#import "CocoaXMLParser.h"
#import "DetailController.h"
@implementation SecondViewController
-@synthesize myParser, shows;
-
-
+@synthesize shows;
- (id) init{
self = [super initWithStyle:UITableViewStyleGrouped];
@@ -37,6 +34,7 @@ - (DetailController *)detailController {
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
+
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
@@ -56,18 +54,23 @@ - (void)didReceiveMemoryWarning
- (void)viewDidLoad
{
+ AppDelegate *appDelegate;
+ appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+
+ shows = [[NSMutableArray alloc] initWithArray:[appDelegate getShows]];
+
+
+
[super viewDidLoad];
if (shows == nil) {
self.shows = [NSMutableArray array];
- } else {
- [shows removeAllObjects];
+ NSLog(@"Shows is void");
+ }
+ else {
[self.tableView reloadData];
+ NSLog(@"Data reloaded");
}
-
- self.myParser = [[[CocoaXMLParser alloc] init] autorelease];
-
- myParser.delegate = self;
- [myParser start];
+
// Do any additional setup after loading the view from its nib
@@ -117,22 +120,6 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-- (void)parserDidEndParsingData:(ShowRSSParser *)parser {
- self.title = [NSString stringWithFormat:NSLocalizedString(@"All %d Shows", @"Top Songs format"), [shows count]];
- [self.tableView reloadData];
- self.navigationItem.rightBarButtonItem.enabled = YES;
- self.myParser = nil;
-}
-
-- (void)parser:(ShowRSSParser *)parser didParseShows:(NSArray *)parsedShows{
- [shows addObjectsFromArray:parsedShows];
- // Three scroll view properties are checked to keep the user interface smooth during parse. When new objects are delivered by the parser, the table view is reloaded to display them. If the table is reloaded while the user is scrolling, this can result in eratic behavior. dragging, tracking, and decelerating can be checked for this purpose. When the parser finishes, reloadData will be called in parserDidEndParsingData:, guaranteeing that all data will ultimately be displayed even if reloadData is not called in this method because of user interaction.
- if (!self.tableView.dragging && !self.tableView.tracking && !self.tableView.decelerating) {
- self.title = [NSString stringWithFormat:NSLocalizedString(@"All %d Shows", @"Top Songs format"), [shows count]];
- [self.tableView reloadData];
- }
-}
-
View
@@ -77,7 +77,7 @@
<float key="IBUISectionFooterHeight">22</float>
</object>
<object class="IBUINavigationItem" key="IBUINavigationItem" id="93248673">
- <string key="IBUITitle">All The Shows</string>
+ <string key="IBUITitle">All Shows</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIParentViewController" ref="85656930"/>
View
@@ -26,11 +26,13 @@ + (XMLParserType)parserType {
}
- (void)start {
+ NSLog(@"Parsing did start");
self.startTimeReference = [NSDate timeIntervalSinceReferenceDate];
[[NSURLCache sharedURLCache] removeAllCachedResponses];
self.parsedShows = [NSMutableArray array];
NSURL *url = [NSURL URLWithString:@"http://www.fredericjacobs.com/rss.xml"];
[NSThread detachNewThreadSelector:@selector(downloadAndParse:) toTarget:self withObject:url];
+ NSLog(@"Parser runs");
}
- (void)dealloc {
View
@@ -0,0 +1,24 @@
+//
+// ShowsParser.h
+// UCLRadio
+//
+// Created by Frederic Jacobs on 12/12/11.
+// Copyright (c) 2011 EPFL. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "ShowRSSParser.h"
+
+@interface ShowsParser : NSObject <ShowRSSParserDelegate> {
+ ShowRSSParser *myShowRSSParser;
+ NSMutableArray *shows;
+ BOOL isDoneParsing;
+}
+@property (nonatomic, retain) NSMutableArray *shows;
+@property (nonatomic, retain) ShowRSSParser *myShowRSSParser;
+
+- (void) startParsing ;
+- (BOOL) getIsDoneParsing;
+- (NSMutableArray *) getAllShows ;
+
+@end
View
@@ -0,0 +1,52 @@
+//
+// ShowsParser.m
+// UCLRadio
+//
+// Created by Frederic Jacobs on 12/12/11.
+// Copyright (c) 2011 EPFL. All rights reserved.
+//
+
+#import "ShowsParser.h"
+#import "CocoaXMLParser.h"
+
+
+
+@implementation ShowsParser
+
+@synthesize myShowRSSParser , shows;
+
+
+- (BOOL) getIsDoneParsing{
+
+ return isDoneParsing;
+}
+
+- (NSMutableArray *) getAllShows{
+
+ return shows;
+
+}
+- (void)parserDidEndParsingData:(ShowRSSParser *)parser {
+ self.myShowRSSParser = nil;
+ isDoneParsing = YES ;
+
+}
+
+- (void)parser:(ShowRSSParser *)parser didParseShows:(NSArray *)parsedShows{
+
+ [shows addObjectsFromArray:parsedShows];
+
+}
+
+- (void) startParsing {
+ isDoneParsing = NO ;
+ shows = [[NSMutableArray alloc]init ];
+ self.myShowRSSParser = [[[CocoaXMLParser alloc]init ]autorelease];
+ myShowRSSParser.delegate = self ;
+ [myShowRSSParser start];
+}
+
+
+
+@end
+
@@ -43,7 +43,9 @@
F45224CB147E9329000A94F5 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F45224C9147E927E000A94F5 /* AudioToolbox.framework */; };
F45224CC147E936D000A94F5 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F45224A5147E8F75000A94F5 /* AVFoundation.framework */; };
F45224CF147E9386000A94F5 /* Twitter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F45224CD147E937C000A94F5 /* Twitter.framework */; };
+ F4A2A2AE1496A55B009B7D40 /* IsDonePlaying.m in Sources */ = {isa = PBXBuildFile; fileRef = F4A2A2AD1496A55B009B7D40 /* IsDonePlaying.m */; };
F4CC507B147EA8A000530C84 /* loadingbutton.png in Resources */ = {isa = PBXBuildFile; fileRef = F4CC507A147EA8A000530C84 /* loadingbutton.png */; };
+ F4F43EAC14967D5C000A0B7F /* ShowsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F4F43EAB14967D5C000A0B7F /* ShowsParser.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -94,7 +96,11 @@
F45224B8147E90D6000A94F5 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
F45224C9147E927E000A94F5 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
F45224CD147E937C000A94F5 /* Twitter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Twitter.framework; path = System/Library/Frameworks/Twitter.framework; sourceTree = SDKROOT; };
+ F4A2A2AC1496A55B009B7D40 /* IsDonePlaying.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IsDonePlaying.h; sourceTree = "<group>"; };
+ F4A2A2AD1496A55B009B7D40 /* IsDonePlaying.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IsDonePlaying.m; sourceTree = "<group>"; };
F4CC507A147EA8A000530C84 /* loadingbutton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = loadingbutton.png; sourceTree = "<group>"; };
+ F4F43EAA14967D5C000A0B7F /* ShowsParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShowsParser.h; sourceTree = "<group>"; };
+ F4F43EAB14967D5C000A0B7F /* ShowsParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShowsParser.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -209,6 +215,8 @@
children = (
F4522455147E88BB000A94F5 /* AppDelegate.h */,
F4522456147E88BB000A94F5 /* AppDelegate.m */,
+ F4A2A2AC1496A55B009B7D40 /* IsDonePlaying.h */,
+ F4A2A2AD1496A55B009B7D40 /* IsDonePlaying.m */,
F452244D147E88BB000A94F5 /* Supporting Files */,
);
path = UCLRadio;
@@ -268,6 +276,8 @@
F4522463147E88F5000A94F5 /* UCLRadioViewController.m */,
F452248C147E89BF000A94F5 /* SecondViewController.h */,
F452248D147E89BF000A94F5 /* SecondViewController.m */,
+ F4F43EAA14967D5C000A0B7F /* ShowsParser.h */,
+ F4F43EAB14967D5C000A0B7F /* ShowsParser.m */,
F452248E147E89BF000A94F5 /* SecondViewController.xib */,
F4522491147E8A11000A94F5 /* DetailController.h */,
F4522492147E8A11000A94F5 /* DetailController.m */,
@@ -363,6 +373,8 @@
F452248A147E8983000A94F5 /* ShowRSSParser.m in Sources */,
F452248F147E89BF000A94F5 /* SecondViewController.m in Sources */,
F4522493147E8A11000A94F5 /* DetailController.m in Sources */,
+ F4F43EAC14967D5C000A0B7F /* ShowsParser.m in Sources */,
+ F4A2A2AE1496A55B009B7D40 /* IsDonePlaying.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -386,7 +398,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CODE_SIGN_ENTITLEMENTS = "";
- CODE_SIGN_IDENTITY = "iPhone Distribution";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -413,7 +425,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CODE_SIGN_ENTITLEMENTS = "";
- CODE_SIGN_IDENTITY = "iPhone Distribution";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -436,8 +448,8 @@
armv7,
armv6,
);
- CODE_SIGN_IDENTITY = "iPhone Distribution";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "UCLRadio/UCLRadio-Prefix.pch";
INFOPLIST_FILE = "UCLRadio/UCLRadio-Info.plist";
@@ -458,8 +470,8 @@
armv7,
armv6,
);
- CODE_SIGN_IDENTITY = "iPhone Distribution";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "UCLRadio/UCLRadio-Prefix.pch";
INFOPLIST_FILE = "UCLRadio/UCLRadio-Info.plist";
@@ -9,11 +9,11 @@
continueAfterRunningActions = "No"
isPathRelative = "1"
filePath = "UCLRadio/AppDelegate.m"
- timestampString = "344022547.77266"
+ timestampString = "345418968.007627"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "233"
- endingLineNumber = "233"
+ startingLineNumber = "263"
+ endingLineNumber = "263"
landmarkName = "-addShow:"
landmarkType = "5">
</FileBreakpoint>
@@ -9,7 +9,7 @@
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
- buildForArchiving = "YES"
+ buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
Oops, something went wrong.

0 comments on commit f0367ae

Please sign in to comment.