Skip to content

Instantly share code, notes, and snippets.

View edwardinubuntu's full-sized avatar

Edward Chiang edwardinubuntu

View GitHub Profile
@edwardinubuntu
edwardinubuntu / gist:758215
Created December 29, 2010 05:28
Application Did Finish Launching
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// ... do things
}
@edwardinubuntu
edwardinubuntu / gist:758216
Created December 29, 2010 05:30
First view Controller push
// ... do things
navController = [[UINavigationControlleralloc] init];
FirstViewController *firstViewController=
[[FirstViewControlleralloc] init];
firstViewController.title = @"First";
[navController pushViewController:firstViewController animated:NO];
[firstViewController release];
[windowaddSubview:navController.view];
// ... do things
@edwardinubuntu
edwardinubuntu / gist:758218
Created December 29, 2010 05:31
Second push View Controller
// ... do things
SecondViewController *secondViewController =
[[SecondViewControlleralloc] init];
secondViewController.title = @"Second";
[self.navigationController pushViewController:
secondViewController animated:YES];
[secondViewController release];
@edwardinubuntu
edwardinubuntu / gist:758219
Created December 29, 2010 05:32
Third Push View Controller
// ... do things
ThirdViewController *thirdViewController =
[[ThirdViewController alloc] init];
[self.navigationController
pushViewController:thirdViewController animated:YES];
[thirdViewController release];
// ... do things
@edwardinubuntu
edwardinubuntu / gist:758233
Created December 29, 2010 05:54
textFile conformsToProtocol
TextFile*textFile = [[TextFile alloc] init];
if ( [ textFile conformsToProtocol:@protocol(Document) ] == YES) {
// do something
}
@edwardinubuntu
edwardinubuntu / gist:758236
Created December 29, 2010 05:57
newDocument conformsToProtocol
-(BOOL) addDocument:(id) newDocument {
if ( [newDocument conformsToProtocol:@protocol(Document)]){
// add the document...
returnYES;
} else
return NO;
}
@edwardinubuntu
edwardinubuntu / gist:758286
Created December 29, 2010 07:01
setWidthHeight selector
SEL setWidthHeight;
setWidthHeight = @selector(setWidth:height:);
@edwardinubuntu
edwardinubuntu / gist:758287
Created December 29, 2010 07:02
myButtonCell selector
[myButtonCell setAction:@selector(reapTheWInd:)];
[myButtonCell setTarget:anObject];
@edwardinubuntu
edwardinubuntu / gist:763197
Created January 3, 2011 07:04
kCLLocationAccuracy
/*
* kCLLocationAccuracy<x>
*
* Discussion:
* Used to specify the accuracy level desired.
* The location service will try its best to achieve
* your desired accuracy. However, it is not guaranteed.
* To optimize power performance,
* be sure to specify an appropriate accuracy for your usage scenario
* eg, use a large accuracy value when only a coarse location is needed.
@edwardinubuntu
edwardinubuntu / gist:763216
Created January 3, 2011 07:35
locationManager:didUpdateToLocation:newLocation:
/*
* locationManager:didUpdateToLocation:fromLocation:
*
* Discussion:
* Invoked when a new location is available.
* oldLocation may be nil if there is no previous location
* available.
*/
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation