blob: b0b22e6f0b77cdacc86f8ee0f09a22bdf50c4da9 [file] [log] [blame]
yangsu@google.comc5aeccd2011-07-17 14:42:08 +00001#import "SkUIRootViewController.h"
2#import "SkUISplitViewController.h"
3@implementation SkUIRootViewController
4@synthesize popoverController, popoverButtonItem;
5
6//Overwritten from UIViewController
7- (void)viewDidLoad {
8 [super viewDidLoad];
9 self.contentSizeForViewInPopover = CGSizeMake(200, self.view.bounds.size.height);
10}
11
12- (void)viewDidUnload {
13 [super viewDidUnload];
14 self.popoverButtonItem = nil;
15}
16
17- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
18 return YES;
19}
20
21- (void)dealloc {
22 [popoverController release];
23 [popoverButtonItem release];
24 [fSamples release];
25 [super dealloc];
26}
27
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
63@end
64