| 1 |
// |
| 2 |
// RootViewController.m |
| 3 |
// NavApp3 |
| 4 |
// |
| 5 |
// Created by David Cole on 6/23/11. |
| 6 |
// Copyright 2011 Kitware, Inc. All rights reserved. |
| 7 |
// |
| 8 |
|
| 9 |
#import "RootViewController.h" |
| 10 |
|
| 11 |
#include "TotalFunction.h" |
| 12 |
|
| 13 |
|
| 14 |
@implementation RootViewController |
| 15 |
|
| 16 |
|
| 17 |
#pragma mark - |
| 18 |
#pragma mark View lifecycle |
| 19 |
|
| 20 |
/* |
| 21 |
- (void)viewDidLoad { |
| 22 |
[super viewDidLoad]; |
| 23 |
|
| 24 |
// Uncomment the following line to display an Edit button in the navigation bar for this view controller. |
| 25 |
// self.navigationItem.rightBarButtonItem = self.editButtonItem; |
| 26 |
} |
| 27 |
*/ |
| 28 |
|
| 29 |
/* |
| 30 |
- (void)viewWillAppear:(BOOL)animated { |
| 31 |
[super viewWillAppear:animated]; |
| 32 |
} |
| 33 |
*/ |
| 34 |
/* |
| 35 |
- (void)viewDidAppear:(BOOL)animated { |
| 36 |
[super viewDidAppear:animated]; |
| 37 |
} |
| 38 |
*/ |
| 39 |
/* |
| 40 |
- (void)viewWillDisappear:(BOOL)animated { |
| 41 |
[super viewWillDisappear:animated]; |
| 42 |
} |
| 43 |
*/ |
| 44 |
/* |
| 45 |
- (void)viewDidDisappear:(BOOL)animated { |
| 46 |
[super viewDidDisappear:animated]; |
| 47 |
} |
| 48 |
*/ |
| 49 |
|
| 50 |
/* |
| 51 |
// Override to allow orientations other than the default portrait orientation. |
| 52 |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { |
| 53 |
// Return YES for supported orientations. |
| 54 |
return (interfaceOrientation == UIInterfaceOrientationPortrait); |
| 55 |
} |
| 56 |
*/ |
| 57 |
|
| 58 |
|
| 59 |
#pragma mark - |
| 60 |
#pragma mark Table view data source |
| 61 |
|
| 62 |
// Customize the number of sections in the table view. |
| 63 |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { |
| 64 |
return 1; |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
// Customize the number of rows in the table view. |
| 69 |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
| 70 |
int n = Total("numberOfRows"); |
| 71 |
return n; |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
// Customize the appearance of table view cells. |
| 76 |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
| 77 |
|
| 78 |
static NSString *CellIdentifier = @"Cell"; |
| 79 |
|
| 80 |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
| 81 |
if (cell == nil) { |
| 82 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
| 83 |
} |
| 84 |
|
| 85 |
// Configure the cell. |
| 86 |
cell.textLabel.text = [NSString stringWithFormat:@"%d", [indexPath row]]; |
| 87 |
|
| 88 |
return cell; |
| 89 |
} |
| 90 |
|
| 91 |
|
| 92 |
/* |
| 93 |
// Override to support conditional editing of the table view. |
| 94 |
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { |
| 95 |
// Return NO if you do not want the specified item to be editable. |
| 96 |
return YES; |
| 97 |
} |
| 98 |
*/ |
| 99 |
|
| 100 |
|
| 101 |
/* |
| 102 |
// Override to support editing the table view. |
| 103 |
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { |
| 104 |
|
| 105 |
if (editingStyle == UITableViewCellEditingStyleDelete) { |
| 106 |
// Delete the row from the data source. |
| 107 |
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; |
| 108 |
} |
| 109 |
else if (editingStyle == UITableViewCellEditingStyleInsert) { |
| 110 |
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. |
| 111 |
} |
| 112 |
} |
| 113 |
*/ |
| 114 |
|
| 115 |
|
| 116 |
/* |
| 117 |
// Override to support rearranging the table view. |
| 118 |
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { |
| 119 |
} |
| 120 |
*/ |
| 121 |
|
| 122 |
|
| 123 |
/* |
| 124 |
// Override to support conditional rearranging of the table view. |
| 125 |
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { |
| 126 |
// Return NO if you do not want the item to be re-orderable. |
| 127 |
return YES; |
| 128 |
} |
| 129 |
*/ |
| 130 |
|
| 131 |
|
| 132 |
#pragma mark - |
| 133 |
#pragma mark Table view delegate |
| 134 |
|
| 135 |
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
| 136 |
|
| 137 |
/* |
| 138 |
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; |
| 139 |
// ... |
| 140 |
// Pass the selected object to the new view controller. |
| 141 |
[self.navigationController pushViewController:detailViewController animated:YES]; |
| 142 |
[detailViewController release]; |
| 143 |
*/ |
| 144 |
} |
| 145 |
|
| 146 |
|
| 147 |
#pragma mark - |
| 148 |
#pragma mark Memory management |
| 149 |
|
| 150 |
- (void)didReceiveMemoryWarning { |
| 151 |
// Releases the view if it doesn't have a superview. |
| 152 |
[super didReceiveMemoryWarning]; |
| 153 |
|
| 154 |
// Relinquish ownership any cached data, images, etc that aren't in use. |
| 155 |
} |
| 156 |
|
| 157 |
- (void)viewDidUnload { |
| 158 |
// Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. |
| 159 |
// For example: self.myOutlet = nil; |
| 160 |
} |
| 161 |
|
| 162 |
|
| 163 |
- (void)dealloc { |
| 164 |
[super dealloc]; |
| 165 |
} |
| 166 |
|
| 167 |
|
| 168 |
@end |