Trouble passing information through segue
Alright. I'm having trouble passing data through a segue from one
UITableViewController to another. The proper information does not load.
Without a bunch of endless talk about the setup, here goes:
On the upper (passing) viewController side:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"deriv"]) {
NSIndexPath *indexPath = [self.tableView2 indexPathForSelectedRow];
DerivationController *destViewController =
segue.destinationViewController;
destViewController.derivationName = [equationsList2
objectAtIndex:indexPath.row];
}
On the receiving viewController side:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"derivCell";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [derivations objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [details objectAtIndex:indexPath.row];
return cell;
}
equationsList2 is a list of equations in an NSArray instance. Depending on
which one is selected, cell.textLabel and cell.detailTextLabel are set
accordingly from NSArrays "derivations" and "details".
The declaration for DerivationController.h is on the passing
viewController's header list.
No errors are thrown.
Any ideas?
No comments:
Post a Comment