0

sending text to label and number to int from tabelview to viewcontroller but it is not working

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    pushnavViewController *detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"pushnavViewController"];

    [self.navigationController pushViewController:detailViewController animated:YES];
    detailViewController.pushh.text = [IDNum objectAtIndex:indexPath.row];
    detailViewController.pushh.text = [listt objectAtIndex:indexPath.row];
}

I also tried to do that , but not working :

detailViewController.pushh.text = [IDNum objectAtIndex:indexPath.row];
detailViewController.pushh.text = [listt objectAtIndex:indexPath.row];
[self.navigationController pushViewController:detailViewController animated:YES];

i made all the property and synthesize them :

@property (nonatomic) UILabel *pushh;
@property (nonatomic) UILabel *IDnumber;

so, any idea?

    NSArray *listt,*IDNum;
5
  • Is it pushing the view controller onscreen? Commented Jun 29, 2012 at 18:09
  • I guess the first things to check are whether IBNum and listt are not null and then that the two calls to objectAtIndex return something meaningful. And that detailViewController is not nil. Commented Jun 29, 2012 at 18:09
  • yes, it is pushing , but not changing the value of label Commented Jun 29, 2012 at 18:13
  • well, for one you are using detailViewController.pushh.text for both assignments. Should be detailViewController.IDnumber.text for the first one, I believe. Secondly, you can't change the .text property of the label until after the view is loaded. Commented Jun 29, 2012 at 18:28
  • share the code for IDNum and listt. Thanks. Commented Jun 29, 2012 at 18:28

1 Answer 1

1

Well, for one you are using detailViewController.pushh.text for both assignments. Should be detailViewController.IDnumber.text for the first one, I believe. Secondly, you can't change the .text property of the label until after the view is loaded.

Instead, create an NSString property and save your information to the NSString, then in your viewDidLoad method of you pushnavViewController assign the label.text with the value of the NSString property.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.