2011-06-24 15:57:30 +00:00
|
|
|
#import "SkUISplitViewController.h"
|
|
|
|
|
|
|
|
@implementation SkUISplitViewController
|
|
|
|
@synthesize fRoot, fDetail;
|
|
|
|
|
|
|
|
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
|
|
|
return YES; //Auto Rotation for all orientations
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
[super viewDidLoad];
|
|
|
|
self.delegate = self;
|
2011-07-17 14:42:08 +00:00
|
|
|
[fDetail populateRoot:fRoot];
|
2011-06-24 15:57:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dealloc {
|
|
|
|
[fRoot release];
|
|
|
|
[fDetail release];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2011-07-07 19:26:42 +00:00
|
|
|
//Table View Delegate Methods
|
2011-06-24 15:57:30 +00:00
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
[fDetail goToItem:indexPath.row];
|
|
|
|
if (fRoot.popoverController != nil) {
|
|
|
|
[fRoot.popoverController dismissPopoverAnimated:YES];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-07 19:26:42 +00:00
|
|
|
//Split View Controller Delegate
|
|
|
|
- (void)splitViewController:(UISplitViewController*)svc
|
|
|
|
willHideViewController:(UIViewController *)aViewController
|
|
|
|
withBarButtonItem:(UIBarButtonItem*)barButtonItem
|
2011-06-24 15:57:30 +00:00
|
|
|
forPopoverController:(UIPopoverController*)pc {
|
2011-07-07 19:26:42 +00:00
|
|
|
|
2011-06-24 15:57:30 +00:00
|
|
|
barButtonItem.title = @"Samples";
|
|
|
|
fRoot.popoverController = pc;
|
|
|
|
fRoot.popoverButtonItem = barButtonItem;
|
|
|
|
[fDetail showRootPopoverButtonItem:fRoot.popoverButtonItem];
|
|
|
|
}
|
|
|
|
|
2011-07-07 19:26:42 +00:00
|
|
|
- (void)splitViewController:(UISplitViewController*)svc
|
|
|
|
willShowViewController:(UIViewController *)aViewController
|
2011-06-24 15:57:30 +00:00
|
|
|
invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {
|
|
|
|
[fDetail invalidateRootPopoverButtonItem:fRoot.popoverButtonItem];
|
|
|
|
fRoot.popoverController = nil;
|
|
|
|
fRoot.popoverButtonItem = nil;
|
|
|
|
}
|
|
|
|
|
2011-07-07 19:26:42 +00:00
|
|
|
@end
|