I have a splitview app, a table with customers to the left and their info on the right so i have to pass witch customer that is clicked and i can't use the name in case of two have the same so im trying to pass over the customer id in the tag property of the cell but i dont get it to work.
Here is where i set the value, i can see it's working when debugging
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
Customer names
NSDate *object = _objects[indexPath.row];
//Customer number
NSString *nr = _kundnr[indexPath.row];
//Customer name
cell.textLabel.text = [object description];
//Customer number
NSInteger Ftgnr = [nr intValue];
//Setting the customer number to cell tag
cell.tag = Ftgnr;
return cell;
}
Here i pick up the cell.tag it's the detailview viewdidload, i tried many different ways to save the id to a variable but the app crashes and i don't know if the value gets passed. It's working to pick up the description (customer name) but i want the id.
- (void)configureView
{
// Update the user interface for the detail item.
if (self.detailItem) {
// NSString *strCellTag = [NSString stringWithFormat:@"%d", [self.detailItem tag]];
//here im trying to pick up the tag value this is where the app craches
NSInteger Ftgnr = [self.detailItem tag];
// NSString *stringformat = [NSString stringWithFormat:@"%d", Ftgnr];
//Its working to pick up the text from the cell
self.detailDescriptionLabel.text = [self.detailItem description];
}
Thank you for your help!