blob: b0b22e6f0b77cdacc86f8ee0f09a22bdf50c4da9 [file] [log] [blame]
yangsu@google.com2eff7e22011-06-24 15:57:30 +00001#import "SkUIRootViewController.h"
2#import "SkUISplitViewController.h"
3@implementation SkUIRootViewController
yangsu@google.com2eff7e22011-06-24 15:57:30 +00004@synthesize popoverController, popoverButtonItem;
5
yangsu@google.com2e20c242011-07-07 19:26:42 +00006//Overwritten from UIViewController
yangsu@google.com2eff7e22011-06-24 15:57:30 +00007- (void)viewDidLoad {
8 [super viewDidLoad];
9 self.contentSizeForViewInPopover = CGSizeMake(200, self.view.bounds.size.height);
10}
11
yangsu@google.com2eff7e22011-06-24 15:57:30 +000012- (void)viewDidUnload {
13 [super viewDidUnload];
14 self.popoverButtonItem = nil;
15}
16
yangsu@google.com2e20c242011-07-07 19:26:42 +000017- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
18 return YES;
19}
20
yangsu@google.com2eff7e22011-06-24 15:57:30 +000021- (void)dealloc {
22 [popoverController release];
23 [popoverButtonItem release];
24 [fSamples release];
25 [super dealloc];
26}
yangsu@google.com2e20c242011-07-07 19:26:42 +000027
28
29//Table View Delegate Methods
30- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
31 // Return the number of sections.
32 return 1;
33}
34
35- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
36 // Return the number of rows in the section.
37 return [fSamples count];
38}
39
40- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
41
42 static NSString *CellIdentifier = @"Cell";
43
44 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
45 if (cell == nil) {
46 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
47 reuseIdentifier:CellIdentifier] autorelease];
48 }
49
50 cell.textLabel.text = [fSamples objectAtIndex:indexPath.row];
51 return cell;
52}
53
54//Instance methods
55- (void)addItem:(NSString*)anItem {
56 [fSamples addObject:anItem];
57}
58
59- (void)initSamples {
60 fSamples = [[NSMutableArray alloc] init];
61}
62
yangsu@google.com2eff7e22011-06-24 15:57:30 +000063@end
64