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

Untitled

By: a guest on May 11th, 2012  |  syntax: None  |  size: 1.11 KB  |  hits: 13  |  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. Loading Table View when clicking on cell
  2. - (void)viewDidLoad
  3. {
  4.     self.title =@"Warranty Length";
  5.     timeLeftArray = [[NSMutableArray alloc]init];
  6.     [timeLeftArray addObject:@"One Year"];
  7.     [timeLeftArray addObject:@"Two Years"];
  8.     [timeLeftArray addObject:@"Three Years"];
  9.     [timeLeftArray addObject:@"Four Years"];
  10.     [timeLeftArray addObject:@"Five Years"];
  11.     [timeLeftArray addObject:@"Six Years"];
  12. }
  13.  
  14. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  15. {
  16.     return 1;
  17. }
  18.  
  19. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  20. {
  21.         return [timeLeftArray count];
  22. }
  23.  
  24.  
  25. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  26. {
  27.     static NSString *CellIdentifier = @"Cell";
  28.  
  29.     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  30.     if (cell == nil) {
  31.         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
  32.     }
  33.  
  34.     // Configure the cell...
  35.     cell.text= [timeLeftArray objectAtIndex:indexPath.row];
  36.  
  37. }