Skip to content

Instantly share code, notes, and snippets.

View edwardinubuntu's full-sized avatar

Edward Chiang edwardinubuntu

View GitHub Profile
@edwardinubuntu
edwardinubuntu / gist:763218
Created January 3, 2011 07:36
locationManager:didFailWithError:
/*
* locationManager:didFailWithError:
*
* Discussion:
* Invoked when an error has occurred.
* Error types are defined in "CLError.h".
*/
- (void)locationManager:(CLLocationManager *)manager
didFailWithError:(NSError *)error;
@edwardinubuntu
edwardinubuntu / gist:769954
Created January 7, 2011 19:17
TTNavigator
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Add navigator
TTNavigator* navigator = [TTNavigator navigator];
navigator.persistenceMode = TTNavigatorPersistenceModeNone;
TTURLMap* map = navigator.URLMap;
// Adding URL Map
[map from:@"*" toViewController:[TTWebController class]];
@edwardinubuntu
edwardinubuntu / gist:769955
Created January 7, 2011 19:18
create model delegate
#pragma mark -
#pragma mark TTModelViewController method
-
(void)createModel {
TTDPRINT(@"Begain");
self.dataSource = [[[RSSFeedDataSource alloc]
initWithSearchQuery:kBlogAccount] autorelease];
}
#pragma mark -
@edwardinubuntu
edwardinubuntu / gist:769956
Created January 7, 2011 19:19
tableViewDidLoadModel
- (void)tableViewDidLoadModel:(UITableView*)tableView {
TTDPRINT(@"Start.");
NSMutableArray* items = [[NSMutableArray alloc] init];
for (RSSFeed* rssFeed in _feedModel.feeds) {
// ...Handle the subtitle items.
[items addObject:[TTTableSubtitleItem
itemWithText:text subtitle:subTitle URL:accessURL]];
/*
* Begain to load
*/
- (void)load:(TTURLRequestCachePolicy)cachePolicy more:(BOOL)more {
if (!self.isLoading && TTIsStringWithAnyText(_searchQuery)) {
// ... Prepare the feed URL
// ... Use TTURLRequest
// ... Use TTURLXMLResponse to use with response
// ... Request send
@edwardinubuntu
edwardinubuntu / gist:770512
Created January 8, 2011 03:36
tableView: cellForRowAtIndexPath:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// ...
}
@edwardinubuntu
edwardinubuntu / gist:771384
Created January 9, 2011 03:22
MySingleton.h
#import <Foundation/Foundation.h>
@interface MySingleton : NSObject {
}
+(MySingleton*)getInstance;
-(void) doSomething;
@end
@edwardinubuntu
edwardinubuntu / gist:771387
Created January 9, 2011 03:27
MySingleton.m
@implementation MySingleton
static MySingleton* _sharedInstance = nil;
+(MySingleton*)getInstance
{
@synchronized([MySingleton class])
{
if (!_sharedInstance)
[[self alloc] init];
return _sharedInstance;
@edwardinubuntu
edwardinubuntu / gist:771391
Created January 9, 2011 03:29
Using MySingleton
[[MySingleton getInstance] doSomething];
@edwardinubuntu
edwardinubuntu / gist:777831
Created January 13, 2011 13:05
UIActionSheetDelegate
@interface ThirdViewController : UIViewController <UIActionSheetDelegate>