RootViewController.m 4.3 KB

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