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;
Well, for one you are using
detailViewController.pushh.textfor both assignments. Should bedetailViewController.IDnumber.textfor the first one, I believe. Secondly, you can’t change the.textproperty of the label until after the view is loaded.Instead, create an
NSStringproperty and save your information to theNSString, then in yourviewDidLoadmethod of youpushnavViewControllerassign thelabel.textwith the value of theNSStringproperty.