Skip to content

Instantly share code, notes, and snippets.

@fbettag
Created June 5, 2011 22:46
Show Gist options
  • Save fbettag/1009506 to your computer and use it in GitHub Desktop.
Save fbettag/1009506 to your computer and use it in GitHub Desktop.
FlowCover XCode
#import "FlowCoverView.h"
@interface FlowCoverViewController : UIViewController {
}
@end
#import "AppDelegate.h"
#import "FlowCoverView.h"
#import "FlowCoverViewController.h"
@implementation FlowCoverViewController
- (id) init {
if (!(self = [super init])) return self;
FlowCoverView *fcview = [[FlowCoverView alloc] initWithFrame:CGRectMake(0.0, 0.0, 460.0, 320.0)];
[fcview setDelegate:self];
[fcview setBackgroundColor:[UIColor blackColor]];
[self setView:fcview];
return self;
}
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||
(interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
- (void) didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void) dealloc {
[super dealloc];
}
- (int) flowCoverNumberImages:(FlowCoverView *)view {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
return [appDelegate.locationTableViewController.fetchedResults.fetchedObjects count];
}
- (UIImage *) flowCover:(FlowCoverView *)view cover:(int)image {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSLog(@"Records found: %i", [appDelegate.locationTableViewController.fetchedResults.fetchedObjects count]);
LocationRecord *rec = [appDelegate.locationTableViewController.fetchedResults.fetchedObjects objectAtIndex:image];
return rec.uiimage;
}
- (void) flowCover:(FlowCoverView *)view didSelect:(int)image {
NSLog(@"Selected Index %d", image);
}
@end
- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
[self presentModalViewController:appDelegate.flowCoverViewController animated:NO];
} else {
[self dismissModalViewControllerAnimated:NO];
}
}
flowCoverViewController = [[FlowCoverViewController alloc] init];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment