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

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 1.78 KB  |  hits: 8  |  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. pass NSMutableArray to UITableViewController
  2. mytable.gettedBooks = newBooksArray; // gettedBooks is NSMutableArray in UITableViewController
  3.  
  4. mytable.try = @"Emyyyyy"; // try is a NSString in UITableViewController
  5.        
  6. NSLog(@"Try: %@", try); // out is null
  7. NSLog(@"my getted array count: %d", [gettedBooks count]); // out is 0
  8.        
  9. @interface RootViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
  10. {
  11.     NSMutableArray         * feed;
  12.     UITableView            * tableView;
  13. }
  14.        
  15. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  16. {
  17.     return [feed count];
  18. }
  19.  
  20. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  21.     static NSString *CellIdentifier = @"Cell";
  22.  
  23.     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  24.     if (cell == nil) {
  25.         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
  26.     }
  27.  
  28.     cell.textLabel.text = [mutableArray objectAtIndex:indexPath.row];
  29.     return cell;
  30. }
  31.        
  32. UITableViewController *viewController = [[UITableViewController alloc] initWithNibName:@"TableXIB" bundle:nil];
  33. [viewController setGettedBooks:newBooksArray];
  34. [self.navigationController pushViewController:viewController animated:YES];
  35.        
  36. NSArray *viewControllers = [self.tabBarController viewControllers];
  37.     MyTableViewController *mTable = [viewControllers objectAtIndex:0];
  38.  
  39.     [mTable SetArrayData:arrayFromViewController];
  40.  
  41.     [mTable.tableView reloadData];
  42.        
  43. NSArray *viewControllers = [self.navigationController viewControllers];
  44.     MyTableViewController *mTable = [viewControllers objectAtIndex:0];
  45.  
  46.     [mTable SetArrayData:arrayFromViewController];
  47.  
  48.     [mTable.tableView reloadData];