I have two View Controllers: MainScreenViewController
and TargetScreenViewController
;
In MainScreenViewController
I have UITableView
with custom cells, in TargetScreenViewController
I have the label which i need change.
I need to get some value, index path for example, and pass it along to TargetScreenViewController
and change the label based on that value.
I already setup the push segue in Triggered Segues in cell, but how can i pass some value and get it there?
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
TargetView *target = [[TargetView alloc]initWithNibName:@"TargetView" bundle:nil];
NSString *data = @"Success";
target.incomingData = data;
}
in TargetView:
- (void)viewDidLoad
{
[super viewDidLoad];
self.mLabel.text = self.incomingData;
}
but label is blank =[
try this .....
1.create a property in your target view controller .
2.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
targetviewcontroller * obj = create object here .
obj.property = dataToBeSent ;
---------------
}
then you will get your data by accessing property