• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#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    fSamples = [[NSMutableArray alloc] init];
11}
12
13- (void)viewDidUnload {
14    [super viewDidUnload];
15    self.popoverButtonItem = nil;
16}
17
18- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
19    return YES;
20}
21
22- (void)dealloc {
23    [popoverController release];
24    [popoverButtonItem release];
25    [fSamples release];
26    [super dealloc];
27}
28
29
30//Table View Delegate Methods
31- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
32    // Return the number of sections.
33    return 1;
34}
35
36- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
37    // Return the number of rows in the section.
38    return [fSamples count];
39}
40
41- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
42
43    static NSString *CellIdentifier = @"Cell";
44
45    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
46    if (cell == nil) {
47        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
48                                       reuseIdentifier:CellIdentifier] autorelease];
49    }
50
51    cell.textLabel.text = [fSamples objectAtIndex:indexPath.row];
52    return cell;
53}
54
55//Instance methods
56- (void)addItem:(NSString*)anItem {
57    [fSamples addObject:anItem];
58}
59
60@end
61
62