diff options
author | matt handler <matt.handler@gmail.com> | 2011-04-29 16:35:15 -0400 |
---|---|---|
committer | matt handler <matt.handler@gmail.com> | 2011-04-29 16:35:15 -0400 |
commit | 869398ebfb18702b9de42f723ff8072b116eb04f (patch) | |
tree | 84a8bbff635bcd4d5c0f6edc42dc535134e02ab4 /Classes | |
parent | e788dbb246a2c9673d595420beca061123526d50 (diff) | |
download | piccast-app-869398ebfb18702b9de42f723ff8072b116eb04f.tar.gz piccast-app-869398ebfb18702b9de42f723ff8072b116eb04f.zip |
changing subscribedSources -> sources, adding instant level today/tomorrow/yesterday for section headers, setting status bar to black and showing once app loads, handling url just an nslog right now, updated image, added piccast:// protocol, setting up faves in the db, adding search and browse views
Diffstat (limited to 'Classes')
-rw-r--r-- | Classes/BrowseViewController.h | 31 | ||||
-rw-r--r-- | Classes/BrowseViewController.m | 201 | ||||
-rw-r--r-- | Classes/BrowseViewController.xib | 538 | ||||
-rw-r--r-- | Classes/PicCastAppDelegate.m | 11 | ||||
-rw-r--r-- | Classes/SearchViewController.h | 39 | ||||
-rw-r--r-- | Classes/SearchViewController.m | 186 | ||||
-rw-r--r-- | Classes/Source.m | 2 | ||||
-rw-r--r-- | Classes/SourcesEditViewController.m | 6 | ||||
-rw-r--r-- | Classes/TabViewController.m | 12 | ||||
-rw-r--r-- | Classes/TopicsViewController.h | 4 | ||||
-rw-r--r-- | Classes/TopicsViewController.m | 26 |
11 files changed, 1033 insertions, 23 deletions
diff --git a/Classes/BrowseViewController.h b/Classes/BrowseViewController.h new file mode 100644 index 0000000..e89ddcd --- /dev/null +++ b/Classes/BrowseViewController.h @@ -0,0 +1,31 @@ +// +// BrowseViewController.h +// PicCast +// +// Created by Matthew Handler on 4/29/11. +// Copyright 2011 Earl Industries. All rights reserved. +// + +#import <UIKit/UIKit.h> +#import "HJObjManager.h" +#import "PhotoViewController.h" +#import "FMDatabase.h" +#import "SectionDictionary.h" +#import "Fetcher.h" +#import "Source.h" + +@interface BrowseViewController : UIViewController <UITableViewDataSource, NSURLProtocolClient, FetcherDelegate> { + //UINavigationController *topicsNavigationController; + NSMutableDictionary *sectionDictionary; + NSMutableDictionary *sourcesDictionary; + + SectionDictionary *tableDictionary; // structure to sync with table + //FeedViewController *feedViewController; // the view that a source points to, which shows recent sets + //PhotoViewController *photoViewController; + + HJObjManager* objMan; +} + +@property (nonatomic, retain) IBOutlet UITableView *tableView; + +@end diff --git a/Classes/BrowseViewController.m b/Classes/BrowseViewController.m new file mode 100644 index 0000000..22742c7 --- /dev/null +++ b/Classes/BrowseViewController.m @@ -0,0 +1,201 @@ +// +// BrowseViewController.m +// PicCast +// +// Created by Matthew Handler on 4/29/11. +// Copyright 2011 Earl Industries. All rights reserved. +// + +#import "BrowseViewController.h" + + +@implementation BrowseViewController + + +@synthesize tableView; + +#pragma mark - +#pragma mark View lifecycle + + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; + + //[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine]; + //[self.tableView setSeparatorColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]]; + + objMan = [[HJObjManager alloc] initWithLoadingBufferSize:6 memCacheSize:20]; + + NSString* cacheDirectory = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/imgcache/icons/"] ; + HJMOFileCache* fileCache = [[[HJMOFileCache alloc] initWithRootPath:cacheDirectory] autorelease]; + objMan.fileCache = fileCache; + + // Have the file cache trim itself down to a size & age limit, so it doesn't grow forever + fileCache.fileCountLimit = 100; + fileCache.fileAgeLimit = 60*60*24*7; //1 week + [fileCache trimCacheUsingBackgroundThread]; + + sectionDictionary = [[[SectionDictionary alloc] init] retain]; + sourcesDictionary = [[[NSMutableDictionary alloc] init] retain]; +} + +- (id)initWithFrame:(CGRect)frame { + + self = [super initWithFrame:frame]; + if (self) { + // Initialization code. + } + return self; +} + +- (void)viewWillAppear:(BOOL)animated { + NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow]; + if (selectedRowIndexPath != nil) { + [self.tableView deselectRowAtIndexPath:selectedRowIndexPath animated:NO]; + } +} + +/* +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; +} +*/ +/* +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; +} +*/ +/* +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; +} +*/ +/* +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; +} +*/ +/* +// Override to allow orientations other than the default portrait orientation. +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + // Return YES for supported orientations. + return (interfaceOrientation == UIInterfaceOrientationPortrait); +} +*/ + + +#pragma mark - +#pragma mark Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + // Return the number of sections. + return 1; //[sectionDictionary count]; +} + + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + // Return the number of rows in the section. + return 3; //[[sectionDictionary objectForIndex:section] count]; +} + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { + return @"category"; +} + +// Customize the appearance of table view cells. +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } + + // Configure the cell... + + 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:[NSArray arrayWithObject: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 - +#pragma mark Table view delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + // Navigation logic may go here. Create and push another view controller. + /* + <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; + // ... + // Pass the selected object to the new view controller. + [self.navigationController pushViewController:detailViewController animated:YES]; + [detailViewController release]; + */ +} + + +#pragma mark - +#pragma mark Memory management + +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Relinquish ownership any cached data, images, etc. that aren't in use. +} + +- (void)viewDidUnload { + // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. + // For example: self.myOutlet = nil; +} + + +- (void)dealloc { + [super dealloc]; +} + + +@end + diff --git a/Classes/BrowseViewController.xib b/Classes/BrowseViewController.xib new file mode 100644 index 0000000..7baf5fb --- /dev/null +++ b/Classes/BrowseViewController.xib @@ -0,0 +1,538 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10"> + <data> + <int key="IBDocument.SystemTarget">1056</int> + <string key="IBDocument.SystemVersion">10J567</string> + <string key="IBDocument.InterfaceBuilderVersion">823</string> + <string key="IBDocument.AppKitVersion">1038.35</string> + <string key="IBDocument.HIToolboxVersion">462.00</string> + <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> + <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="NS.object.0">132</string> + </object> + <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> + <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="8"/> + </object> + <object class="NSArray" key="IBDocument.PluginDependencies"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + </object> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys" id="0"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBProxyObject" id="372490531"> + <string key="IBProxiedObjectIdentifier">IBFilesOwner</string> + <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> + </object> + <object class="IBProxyObject" id="975951072"> + <string key="IBProxiedObjectIdentifier">IBFirstResponder</string> + <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> + </object> + <object class="IBUIView" id="830177019"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">292</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBUITableView" id="873029372"> + <reference key="NSNextResponder" ref="830177019"/> + <int key="NSvFlags">274</int> + <string key="NSFrame">{{0, 44}, {320, 387}}</string> + <reference key="NSSuperview" ref="830177019"/> + <object class="NSColor" key="IBUIBackgroundColor"> + <int key="NSColorSpace">10</int> + <object class="NSImage" key="NSImage"> + <int key="NSImageFlags">549453824</int> + <string key="NSSize">{84, 1}</string> + <object class="NSMutableArray" key="NSReps"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray"> + <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="0"/> + <object class="NSBitmapImageRep"> + <object class="NSData" key="NSTIFFRepresentation"> + <bytes key="NS.bytes">TU0AKgAAAVjFzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/ +y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/ +xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/ +xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/ +xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/ +xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P8ADQEAAAMAAAABAFQAAAEB +AAMAAAABAAEAAAECAAMAAAAEAAAB+gEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES +AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABAAEAAAEXAAQAAAABAAABUAEcAAMAAAABAAEAAAFS +AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes> + </object> + </object> + </object> + </object> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MCAwAA</bytes> + </object> + </object> + <string key="IBUIColorCocoaTouchKeyPath">groupTableViewBackgroundColor</string> + </object> + <bool key="IBUIOpaque">NO</bool> + <bool key="IBUIClipsSubviews">YES</bool> + <bool key="IBUIClearsContextBeforeDrawing">NO</bool> + <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/> + <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> + <bool key="IBUIBouncesZoom">NO</bool> + <int key="IBUIStyle">1</int> + <int key="IBUISeparatorStyle">2</int> + <int key="IBUISectionIndexMinimumDisplayRowCount">0</int> + <bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool> + <float key="IBUIRowHeight">44</float> + <float key="IBUISectionHeaderHeight">10</float> + <float key="IBUISectionFooterHeight">10</float> + </object> + <object class="IBUINavigationBar" id="746896018"> + <reference key="NSNextResponder" ref="830177019"/> + <int key="NSvFlags">290</int> + <string key="NSFrameSize">{320, 44}</string> + <reference key="NSSuperview" ref="830177019"/> + <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> + <object class="NSColor" key="IBUITintColor"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MC4wOTMzOTc2Mzk2OSAwLjE3NTQ0MzM4MTEgMC4yNTAzODczMTEAA</bytes> + </object> + <object class="NSArray" key="IBUIItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBUINavigationItem" id="1068085944"> + <reference key="IBUINavigationBar" ref="746896018"/> + <string key="IBUITitle">PicCast</string> + <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> + </object> + </object> + </object> + </object> + <string key="NSFrameSize">{320, 431}</string> + <reference key="NSSuperview"/> + <object class="NSColor" key="IBUIBackgroundColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + <object class="NSColorSpace" key="NSCustomColorSpace"> + <int key="NSID">2</int> + </object> + </object> + <object class="IBUISimulatedTabBarMetrics" key="IBUISimulatedBottomBarMetrics"/> + <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> + </object> + </object> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <object class="NSMutableArray" key="connectionRecords"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">dataSource</string> + <reference key="source" ref="873029372"/> + <reference key="destination" ref="372490531"/> + </object> + <int key="connectionID">6</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">delegate</string> + <reference key="source" ref="873029372"/> + <reference key="destination" ref="372490531"/> + </object> + <int key="connectionID">7</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">tableView</string> + <reference key="source" ref="372490531"/> + <reference key="destination" ref="873029372"/> + </object> + <int key="connectionID">11</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">view</string> + <reference key="source" ref="372490531"/> + <reference key="destination" ref="830177019"/> + </object> + <int key="connectionID">19</int> + </object> + </object> + <object class="IBMutableOrderedSet" key="objectRecords"> + <object class="NSArray" key="orderedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <reference key="object" ref="0"/> + <reference key="children" ref="1000"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="372490531"/> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="975951072"/> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">8</int> + <reference key="object" ref="830177019"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="746896018"/> + <reference ref="873029372"/> + </object> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">9</int> + <reference key="object" ref="746896018"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1068085944"/> + </object> + <reference key="parent" ref="830177019"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">10</int> + <reference key="object" ref="1068085944"/> + <reference key="parent" ref="746896018"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">4</int> + <reference key="object" ref="873029372"/> + <reference key="parent" ref="830177019"/> + </object> + </object> + </object> + <object class="NSMutableDictionary" key="flattenedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>-1.CustomClassName</string> + <string>-2.CustomClassName</string> + <string>10.IBPluginDependency</string> + <string>4.IBEditorWindowLastContentRect</string> + <string>4.IBPluginDependency</string> + <string>4.IBViewBoundsToFrameTransform</string> + <string>8.IBEditorWindowLastContentRect</string> + <string>8.IBPluginDependency</string> + <string>8.IBViewBoundsToFrameTransform</string> + <string>9.IBPluginDependency</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>BrowseViewController</string> + <string>UIResponder</string> + <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string>{{329, 376}, {320, 480}}</string> + <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <object class="NSAffineTransform"> + <bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAw9aAAA</bytes> + </object> + <string>{{114, 369}, {320, 480}}</string> + <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <object class="NSAffineTransform"> + <bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAw9aAAA</bytes> + </object> + <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + </object> + </object> + <object class="NSMutableDictionary" key="unlocalizedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference key="dict.sortedKeys" ref="0"/> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="activeLocalization"/> + <object class="NSMutableDictionary" key="localizations"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference key="dict.sortedKeys" ref="0"/> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="sourceID"/> + <int key="maxID">19</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <object class="NSMutableArray" key="referencedPartialClassDescriptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">BrowseViewController</string> + <string key="superclassName">UIViewController</string> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">tableView</string> + <string key="NS.object.0">UITableView</string> + </object> + <object class="NSMutableDictionary" key="toOneOutletInfosByName"> + <string key="NS.key.0">tableView</string> + <object class="IBToOneOutletInfo" key="NS.object.0"> + <string key="name">tableView</string> + <string key="candidateClassName">UITableView</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">Classes/BrowseViewController.h</string> + </object> + </object> + </object> + <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSError.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSThread.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURL.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="317748069"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UIResponder.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIBarButtonItem</string> + <string key="superclassName">UIBarItem</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UIBarButtonItem.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIBarItem</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UIBarItem.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UINavigationBar</string> + <string key="superclassName">UIView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="744273050"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UINavigationBar.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UINavigationItem</string> + <string key="superclassName">NSObject</string> + <reference key="sourceIdentifier" ref="744273050"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIResponder</string> + <string key="superclassName">NSObject</string> + <reference key="sourceIdentifier" ref="317748069"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIScrollView</string> + <string key="superclassName">UIView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UISearchBar</string> + <string key="superclassName">UIView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UISearchDisplayController</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UITableView</string> + <string key="superclassName">UIScrollView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UITableView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UIPrintFormatter.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UITextField.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIView</string> + <string key="superclassName">UIResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UIView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIViewController</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIViewController</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIViewController</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIViewController</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">UIViewController</string> + <string key="superclassName">UIResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">UIKit.framework/Headers/UIViewController.h</string> + </object> + </object> + </object> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string> + <integer value="1056" key="NS.object.0"/> + </object> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string> + <integer value="3000" key="NS.object.0"/> + </object> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> + <string key="IBDocument.LastKnownRelativeProjectPath">../PicCast.xcodeproj</string> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + <string key="IBCocoaTouchPluginVersion">132</string> + </data> +</archive> diff --git a/Classes/PicCastAppDelegate.m b/Classes/PicCastAppDelegate.m index a3bc294..3da5a07 100644 --- a/Classes/PicCastAppDelegate.m +++ b/Classes/PicCastAppDelegate.m @@ -50,6 +50,9 @@ // Override point for customization after application launch. // Add the tab bar controller's view to the window and display. + NSLog(@"launched"); + [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; + [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque]; [self.window addSubview:tabBarController.view]; [self.window makeKeyAndVisible]; @@ -134,9 +137,11 @@ [self prompt:title withMessage:message andButtonTitle:buttonTitle withDelegate:self]; } -//- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { -// return [facebook handleOpenURL:url]; -//} +- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { + NSLog(@"url: %@", [url absoluteString]); + return YES; + //return [facebook handleOpenURL:url]; +} + (NSString *) getDatabasePath { NSString *databaseName = @"PicCastSqlTable.db"; diff --git a/Classes/SearchViewController.h b/Classes/SearchViewController.h new file mode 100644 index 0000000..6888c9e --- /dev/null +++ b/Classes/SearchViewController.h @@ -0,0 +1,39 @@ +// +// SearchViewController.h +// PicCast +// +// Created by Matthew Handler on 4/28/11. +// Copyright 2011 Earl Industries. All rights reserved. +// + +// returned feeds -> turn on/off +// returned sets -> view +// later: returned pics -> view +// later: returned categories -> browse + +#import <UIKit/UIKit.h> +#import "HJObjManager.h" + +#import "PhotoViewController.h" +#import "FMDatabase.h" +#import "SectionDictionary.h" +#import "Fetcher.h" +#import "Source.h" + +@interface SearchViewController : UIViewController <FetcherDelegate, UISearchBarDelegate, UITableViewDataSource> { + //UINavigationController *topicsNavigationController; + NSMutableDictionary *sourcesDictionary; + + SectionDictionary *tableDictionary; // structure to sync with table + PhotoViewController *photoViewController; + + HJObjManager* objMan; + + FMDatabase* db; + NSString *searchString; +} + +@property (nonatomic, retain) IBOutlet UISearchBar *mainSearchBar; +@property (nonatomic, retain) IBOutlet UITableView *tableView; + +@end diff --git a/Classes/SearchViewController.m b/Classes/SearchViewController.m new file mode 100644 index 0000000..8272dd9 --- /dev/null +++ b/Classes/SearchViewController.m @@ -0,0 +1,186 @@ +// +// SearchViewController.m +// PicCast +// +// Created by Matthew Handler on 4/28/11. +// Copyright 2011 Earl Industries. All rights reserved. +// + +#import "SearchViewController.h" +#import "PicCastAppDelegate.h" + + +@implementation SearchViewController + +@synthesize tableView, mainSearchBar; + +- (void)viewDidLoad { + [super viewDidLoad]; + + [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine]; + [self.tableView setSeparatorColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]]; + + objMan = [[HJObjManager alloc] initWithLoadingBufferSize:6 memCacheSize:20]; + + NSString* cacheDirectory = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/imgcache/icons/"] ; + HJMOFileCache* fileCache = [[[HJMOFileCache alloc] initWithRootPath:cacheDirectory] autorelease]; + objMan.fileCache = fileCache; + + // Have the file cache trim itself down to a size & age limit, so it doesn't grow forever + fileCache.fileCountLimit = 100; + fileCache.fileAgeLimit = 60*60*24*7; //1 week + [fileCache trimCacheUsingBackgroundThread]; + + tableDictionary = [[[SectionDictionary alloc] init] retain]; + sourcesDictionary = [[[NSMutableDictionary alloc] init] retain]; + + db = [[FMDatabase databaseWithPath:[PicCastAppDelegate getDatabasePath]] retain]; + [db setShouldCacheStatements:NO]; + // [db setTraceExecution:true]; + // [db setLogsErrors:true]; + +// [self getTopicsFromDb]; +// +// [self loadSubscribedTopics]; +} + +- (id)initWithFrame:(CGRect)frame { + + self = [super initWithFrame:frame]; + if (self) { + // Initialization code. + } + return self; +} + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code. +} +*/ + +- (void)viewWillAppear:(BOOL)animated { + NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow]; + if (selectedRowIndexPath != nil) { + [self.tableView deselectRowAtIndexPath:selectedRowIndexPath animated:NO]; + } +} + +#pragma mark - +#pragma mark UISearchBar protocol + +- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { + +// if ([searchText length] > 0) { +// NSError *error = NULL; +// NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[^a-zA-Z]" +// options:NSRegularExpressionCaseInsensitive +// error:&error]; +// +// NSString *newString = [regex stringByReplacingMatchesInString:searchText +// options:NSRegularExpressionCaseInsensitive +// range:[searchBar.text rangeOfString:searchText] +// withTemplate:@""]; +// +// if (![newString isEqualToString:searchBar.text]) +// searchBar.text = newString; +// } +} + +- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { + [searchBar setShowsCancelButton:YES animated:YES]; + self.tableView.allowsSelection = NO; + self.tableView.scrollEnabled = NO; +} + +- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { + searchBar.text = @""; + + [searchBar setShowsCancelButton:NO animated:YES]; + [searchBar resignFirstResponder]; + self.tableView.allowsSelection = YES; + self.tableView.scrollEnabled = YES; +} + +- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { + [searchBar setShowsCancelButton:NO animated:YES]; + [searchBar resignFirstResponder]; + +// [MBProgressHUD showHUDAddedTo:self.view animated:YES]; +// +// _searchString = [searchBar.text copy]; +// [searchBar setShowsCancelButton:NO animated:YES]; +// [searchBar resignFirstResponder]; +// +// NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.werdmerge.com/search.php?word=%@", searchBar.text]] +// cachePolicy:NSURLRequestUseProtocolCachePolicy +// timeoutInterval:60.0]; +// +// if ([NSURLConnection connectionWithRequest:theRequest delegate:self]) { +// [_receivedData setLength:0]; +// } else { +// [MBProgressHUD hideHUDForView:self.view animated:YES]; +// [WerdMergeAppDelegate prompt:@"Error" withMessage:@"No internet connection" andButtonTitle:@"shucks" withDelegate:self]; +// } +// +// [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:YES] forKey:@"haveSearched"]; + +} + +#pragma mark - +#pragma mark uitableviewcontroller protocol + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 10; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return 5; +} + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { + return @"tamper proof cap"; +} + +//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +//{ +// if (indexPath.section + 1 == [tableDictionary count] && +// indexPath.row == [[tableDictionary objectForIndex:indexPath.section] count]) +// return 44; +// else +// return 100; +//} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *identifier = @"resultCell"; + + UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:identifier]; + + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease]; + } + + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + +} + + +- (void)dealloc { + [mainSearchBar release]; + [tableView release]; + [tableDictionary release]; + [photoViewController release]; + [sourcesDictionary release]; + [objMan release]; + [searchString release]; + [super dealloc]; +} + + +@end diff --git a/Classes/Source.m b/Classes/Source.m index bde21b0..2369d1f 100644 --- a/Classes/Source.m +++ b/Classes/Source.m @@ -63,7 +63,7 @@ - (void) serializeToDb:(FMDatabase *)db { [db retain]; - [db executeUpdate:@"INSERT INTO subscribedSources \ + [db executeUpdate:@"INSERT INTO sources \ (foreignId, title, subscribed, category, favicon) \ VALUES \ (?, ?, ?, ?, ?);", diff --git a/Classes/SourcesEditViewController.m b/Classes/SourcesEditViewController.m index 7c7bf7b..857dbb0 100644 --- a/Classes/SourcesEditViewController.m +++ b/Classes/SourcesEditViewController.m @@ -75,7 +75,7 @@ - (void) loadSourcesFromDb { [db open]; - FMResultSet *result = [db executeQuery:@"SELECT * FROM subscribedSources"]; + FMResultSet *result = [db executeQuery:@"SELECT * FROM sources"]; while ([result next]) { Source *source = [Source initFromDatabaseRow:result]; [sectionDictionary appendObject:source forKey:source.category]; @@ -131,7 +131,7 @@ [db open]; for (NSDictionary *obj in array) { //NSLog(@"foreign key: %d", [obj objectForKey:@"id"]); - FMResultSet *result = [db executeQuery:@"SELECT * FROM subscribedSources WHERE foreignId = ?", [obj objectForKey:@"id"]]; + FMResultSet *result = [db executeQuery:@"SELECT * FROM sources WHERE foreignId = ?", [obj objectForKey:@"id"]]; if (![result next]) { //NSLog(@"found source"); Source *source = [Source initWithJsonObject:obj]; @@ -264,7 +264,7 @@ [db open]; [db beginTransaction]; - [db executeUpdate:@"UPDATE subscribedSources SET subscribed = ? WHERE foreignId = ?", [NSNumber numberWithInt:(switcher.on ? 1 : 0)], foreignId]; + [db executeUpdate:@"UPDATE sources SET subscribed = ? WHERE foreignId = ?", [NSNumber numberWithInt:(switcher.on ? 1 : 0)], foreignId]; [db commit]; [db close]; } diff --git a/Classes/TabViewController.m b/Classes/TabViewController.m index c4ada83..6aaa9f6 100644 --- a/Classes/TabViewController.m +++ b/Classes/TabViewController.m @@ -36,13 +36,13 @@ } */ -/* + // Override to allow orientations other than the default portrait orientation. -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - // Return YES for supported orientations - return (interfaceOrientation == UIInterfaceOrientationPortrait); -} -*/ +//- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { +// // Return YES for supported orientations +// return YES; //(interfaceOrientation == UIInterfaceOrientationPortrait); +//} + - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. diff --git a/Classes/TopicsViewController.h b/Classes/TopicsViewController.h index 98a678c..bdd9eda 100644 --- a/Classes/TopicsViewController.h +++ b/Classes/TopicsViewController.h @@ -26,6 +26,10 @@ HJObjManager* objMan; FMDatabase* db; + + NSString *_today; + NSString *_yesterday; + NSString *_tomorrow; } - (IBAction)showSources:(id)sender; diff --git a/Classes/TopicsViewController.m b/Classes/TopicsViewController.m index 3ad8d95..d7ca089 100644 --- a/Classes/TopicsViewController.m +++ b/Classes/TopicsViewController.m @@ -35,6 +35,10 @@ [self.tableView setSeparatorColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]]; objMan = [[HJObjManager alloc] initWithLoadingBufferSize:6 memCacheSize:20]; + + _today = [[Topic dateToString:[NSDate new]] retain]; + _yesterday = [[Topic dateToString:[NSDate dateWithTimeIntervalSinceNow:(NSTimeInterval)-86400]] retain]; + _tomorrow = [[Topic dateToString:[NSDate dateWithTimeIntervalSinceNow:(NSTimeInterval)+86400]] retain]; NSString* cacheDirectory = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/imgcache/icons/"] ; HJMOFileCache* fileCache = [[[HJMOFileCache alloc] initWithRootPath:cacheDirectory] autorelease]; @@ -81,6 +85,8 @@ [dateFormatter setTimeStyle:NSDateFormatterNoStyle]; [dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"US"] autorelease]]; + // convert releasedate to today if its tomorrow, acidcowwwww! + [tableDictionary appendObject:topic forKey:[dateFormatter dateFromString:[dateFormatter stringFromDate:topic.releaseDate]]]; } @@ -177,7 +183,7 @@ - (void) loadSubscribedTopics { //NSLog(@"load subscribed"); [db open]; - FMResultSet *result = [db executeQuery:@"SELECT * FROM subscribedSources WHERE subscribed = ?", [NSNumber numberWithInt:1]]; + FMResultSet *result = [db executeQuery:@"SELECT * FROM sources WHERE subscribed = ?", [NSNumber numberWithInt:1]]; while ([result next]) { Source *source = [[[Source alloc] init] autorelease]; if ([sourcesDictionary objectForKey:[NSNumber numberWithInt:[result intForColumn:@"foreignId"]]] != nil) { @@ -253,18 +259,15 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { //NSLog(@"row title: %@", [tableDictionary keyForIndex:section]); //return [tableDictionary keyForIndex:section]; //how do you convert a key to index from mutabledictionary - NSDate *date = [NSDate new]; + NSString *key = [Topic dateToString:[tableDictionary keyForIndex:section]]; - NSString *today = [Topic dateToString:date]; - NSString *yesterday = [Topic dateToString:[NSDate dateWithTimeIntervalSinceNow:(NSTimeInterval)-86400]]; - //NSLog(@"%@ %@ %@ %@", date, key, today, yesterday); - //NSLog(@"%@", [tableDictionary allIndices], [tableDictionary ); - //NSLog(@"%@", [tableDictionary allKeys]); - //[tableDictionary allIndices]; - if ([key compare:today] == 0) + + if ([key compare:_today] == 0) return @"Today"; - else if ([key compare:yesterday] == 0) + else if ([key compare:_yesterday] == 0) return @"Yesterday"; + else if ([key compare:_tomorrow] == 0) + return @"Tomorrow"; else return key; @@ -506,6 +509,9 @@ } - (void)dealloc { + [_today release]; + [_yesterday release]; + [_tomorrow release]; [db release]; [sourcesDictionary release]; [tableDictionary release]; |