Advertisement
Guest User

Untitled

a guest
Apr 15th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Setting the properties for my object.
  2.  
  3. - (void)viewDidLoad
  4. {
  5.     [super viewDidLoad];
  6.    
  7.     _objects = [[NSMutableArray alloc] init];
  8.     [_objects addObject:[[Material alloc] initWithMaterialName:@"Sydyru Bone" bountyName:@[@"Glidewing", @"Firestarter", @"Carrion Farm"] waypointName:@[@"Cathedral L1", @"Cathedral L2", @"Fields of Misery"] actName:@[@"Act 1", @"Act 1", @"Act 1"]]];
  9.    
  10. }
  11.  
  12. // Showing the materialName property of the object in a table cell.
  13.  
  14. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  15. {
  16.     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
  17.    
  18.     Material *object = _objects[indexPath.row];
  19.     cell.textLabel.text = [NSString stringWithFormat:@"%@", object.materialName];
  20.     return cell;
  21. }
  22.  
  23. // Sending the properties of the object from master view controller to detail view controller.
  24.  
  25. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  26. {
  27.      if ([[segue identifier] isEqualToString:@"showDetail"]) {
  28.      NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
  29.      Material *object = _objects[indexPath.row];
  30.      [[segue destinationViewController] setDetailItem:object];
  31.      }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement