While using the DetailViewController the value is not passing from the UITabelViewController, is it any wrong with the code?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
detailedvu *dvController = [[detailedvu alloc] initWithNibName:@"detailedvu" bundle:[NSBundle mainBundle]];
if (0 == indexPath.row)
{
NSLog(@"0");
dvController.lb1.text = @"Make";
}
[self.navigationController pushViewController:dvController animated:YES];
}
Please help me to sort out.
The
dvcontrolleris instantiated correctly.The problem here is that thelblis a label from the nib(i think).So when pushed to the viewcontroller a new instance is created so the setting here does not make any sense.Pass it in a data holder such as NSString and load the label in the
viewdidLoadof thedetailedvuOne suggestion : Please try to follow the naming conventions for better readability
Happy Coding 🙂