Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Setting the properties for my object.
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- _objects = [[NSMutableArray alloc] init];
- [_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"]]];
- }
- // Showing the materialName property of the object in a table cell.
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
- Material *object = _objects[indexPath.row];
- cell.textLabel.text = [NSString stringWithFormat:@"%@", object.materialName];
- return cell;
- }
- // Sending the properties of the object from master view controller to detail view controller.
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
- {
- if ([[segue identifier] isEqualToString:@"showDetail"]) {
- NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
- Material *object = _objects[indexPath.row];
- [[segue destinationViewController] setDetailItem:object];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement