I have the code below : where Cell new is Custom cell which has array which has object at index when user selects a row which has to be transfered to anothe uiviewcontroller to display that msg But I am unable to do that.
by doing this : I get an error Incompatible pointer types assigning to 'NSString *' from 'UILabel *'
VC2.DisplayMsg.text = cell.textLabel;
displayMsg is a label in uiviewcontroller where the text has to be displayed.Where Am I going wrong?
Please help me out or suggest any other way to transfer value from navigational uitableviwController to another viewcontroller on selecting the row and displaying the message in that uiviewController.Please help me out.I appreciate a great deal.
Thanks in Advance.
Complete code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Cellnew *cell = [array objectAtIndex:indexPath.row];
ViewControllerDisplayMsg *VC2 = [[ViewControllerDisplayMsg alloc] init];
VC2.DisplayMsgtext = cell.textLabel.text;
[self performSegueWithIdentifier:@"displayMsgSegueIdentifier" sender:self];
}
The error :
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString textLabel]: unrecognized selector sent to instance