This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@class Dog; | |
@protocol DogDelegate <NSObject> | |
@optional | |
-(void) dogWillStartBarking:(Dog *) aDog; | |
-(void) dogDidFinishBarking:(Dog *) aDog; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad { | |
dog = [[Dog alloc] init]; | |
dog.delegate = self; | |
[dog bark]; | |
[super viewDidLoad]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(IBAction) selectRegion:(id) sender | |
{ | |
[NSThread detachNewThreadSelector:@selector(threadStartAnimating:) toTarget:self withObject:nil]; | |
} | |
- (void)threadStartAnimating:(id)data | |
{ | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
[NSThread sleepForTimeInterval:1.0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Schedules timer on the spinner thread. | |
*/ | |
-(void) scheduleSpinner { | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
NSTimer *spinnerTimer = [NSTimer scheduledTimerWithTimeInterval:SPIN_FIRE_INTERVAL target:self selector:@selector(timerFireMethod:) userInfo:nil repeats:YES]; | |
NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; | |
BOOL isMainThread = [NSThread isMainThread]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First Lazy method. | |
ViewControllerA *controllerA = self.parentViewController; | |
[controllerA.parentViewController dismissModalViewControllerAnimated:YES]; | |
// Second Lazier Method | |
[self.parentViewController.parentViewController dismissModalViewControllerAnimated:YES]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) scrollEffectInDirection:(ScrollDirection) direction{ | |
ContentView *previousPageView = (ContentView *)[self.pageScrollView viewWithTag:kPreviousPageTag]; | |
ContentView *currentPageView = (ContentView *)[self.pageScrollView viewWithTag:kCurrentPageTag]; | |
ContentView *nextPageView = (ContentView *)[self.pageScrollView viewWithTag:kNextPageTag]; | |
switch (direction) { | |
case kScrollDirectionNone: | |
[self fillPageView:currentPageView withPageNumber:self.currentPage.pageNumber]; | |
[self fillPageView:previousPageView withPageNumber:self.currentPage.pageNumber - 1]; | |
[self fillPageView:nextPageView withPageNumber:self.currentPage.pageNumber + 1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIFont *labelFont = [UIFont fontWithName:fontName size:fontSize]; | |
label.font = labelFont; | |
CGSize labelSize = [label.text sizeWithFont:label.font]; | |
label.frame.size = labelSize; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[UIView beginAnimations:@"FlipAnimation" context:nil]; | |
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:myFirstDrillDownView cache:NO]; | |
[UIView setAnimationBeginsFromCurrentState:YES]; | |
[myFirstDrillDownView exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; | |
[UIView commitAnimations]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) show { | |
[UIView beginAnimations:[NSString stringWithFormat:@"%d", _serialNumber] context:nil]; | |
[UIView setAnimationDuration:0.3f]; | |
[UIView setAnimationCurve:UIViewAnimationCurveLinear]; | |
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self cache:YES]; | |
[UIView setAnimationDelegate:self]; | |
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; | |
[self addSubview:_frontView]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef enum { | |
kScrollDirectionLeft = -1, | |
kScrollDirectionNone, | |
kScrollDirectionRight | |
}ScrollDirection; | |
-(void) scrollEffectInDirection:(ScrollDirection) direction{ | |
ContentView *previousPageView = (ContentView *)[self.pageScrollView viewWithTag:kPreviousPageTag]; | |
ContentView *currentPageView = (ContentView *)[self.pageScrollView viewWithTag:kCurrentPageTag]; | |
ContentView *nextPageView = (ContentView *)[self.pageScrollView viewWithTag:kNextPageTag]; |