Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: Objective C  |  size: 4.11 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //
  2. //  SolverResultsTableViewController.m
  3. //  bestofdrawsomething
  4. //
  5. //  Created by Jason Malashock on 5/8/12.
  6. //  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
  7. //
  8.  
  9. #import "SolverResultsTableViewController.h"
  10.  
  11. @interface SolverResultsTableViewController ()
  12.  
  13. @end
  14.  
  15. @implementation SolverResultsTableViewController
  16.  
  17. @synthesize solverResultsArray;
  18.  
  19. - (id)initWithStyle:(UITableViewStyle)style
  20. {
  21.     self = [super initWithStyle:style];
  22.     if (self) {
  23.         // Custom initialization
  24.     }
  25.     return self;
  26. }
  27.  
  28. - (void)viewDidLoad
  29. {
  30.     [super viewDidLoad];
  31.    
  32.      solverResultsArray = [NSArray arrayWithObjects: @"ironman", @"ladygaga", @"poop", @"plumber", @"depp", nil];
  33.  
  34.     // Uncomment the following line to preserve selection between presentations.
  35.     // self.clearsSelectionOnViewWillAppear = NO;
  36.  
  37.     // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
  38.     // self.navigationItem.rightBarButtonItem = self.editButtonItem;
  39. }
  40.  
  41. - (void)viewDidUnload
  42. {
  43.     [super viewDidUnload];
  44.     // Release any retained subviews of the main view.
  45.     // e.g. self.myOutlet = nil;
  46. }
  47.  
  48. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  49.     // Return YES for supported orientations
  50.     return (interfaceOrientation == UIInterfaceOrientationPortrait) ||
  51.     (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
  52. }
  53.  
  54. #pragma mark - Table view data source
  55.  
  56. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  57. {
  58. #warning Potentially incomplete method implementation.
  59.     // Return the number of sections.
  60.     return 1;
  61. }
  62.  
  63. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  64. {
  65. #warning Incomplete method implementation.
  66.     // Return the number of rows in the section.
  67.     return self.solverResultsArray.count;
  68. }
  69.  
  70. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  71. {
  72.     static NSString *CellIdentifier = @"Cell";
  73.     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  74.    
  75.     // Configure the cell...
  76.    
  77.     return cell;
  78. }
  79.  
  80. /*
  81. // Override to support conditional editing of the table view.
  82. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
  83. {
  84.     // Return NO if you do not want the specified item to be editable.
  85.     return YES;
  86. }
  87. */
  88.  
  89. /*
  90. // Override to support editing the table view.
  91. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
  92. {
  93.     if (editingStyle == UITableViewCellEditingStyleDelete) {
  94.         // Delete the row from the data source
  95.         [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
  96.     }  
  97.     else if (editingStyle == UITableViewCellEditingStyleInsert) {
  98.         // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
  99.     }  
  100. }
  101. */
  102.  
  103. /*
  104. // Override to support rearranging the table view.
  105. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
  106. {
  107. }
  108. */
  109.  
  110. /*
  111. // Override to support conditional rearranging of the table view.
  112. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
  113. {
  114.     // Return NO if you do not want the item to be re-orderable.
  115.     return YES;
  116. }
  117. */
  118.  
  119. #pragma mark - Table view delegate
  120.  
  121. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  122. {
  123.     // Navigation logic may go here. Create and push another view controller.
  124.     /*
  125.      <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
  126.      // ...
  127.      // Pass the selected object to the new view controller.
  128.      [self.navigationController pushViewController:detailViewController animated:YES];
  129.      [detailViewController release];
  130.      */
  131. }
  132.  
  133. @end