A better approach would be to create an NSString*
property on AddTaskViewController
. You can do it like this:
In AddTaskViewController.h
add the following:
@property (nonatomic, strong) NSString* myLabelsText;
then in AddTaskViewController.m
be sure to add this in viewWillAppear
:
self.testlabel.text = self.myLabelsText;
Now assuming you've declared your testLabel
and myLabelsText
appropriately and they get synthesized, your view controller will apply the string correctly at the proper time and your function should then be changed to this:
- (IBAction)donebutton:(id)sender {
AddTaskViewController *addtask = [[AddTaskViewController alloc]initWithNibName:@"AddTask" bundle:nil];
// Set the value on your new NSString* property and let the view controller handle the rest
addTask.myLabelsText = self.zaman1.text;
// Don't you want to 'present' the view controller rather than 'dismiss' after having provided it with data?
[self dismissViewControllerAnimated:YES completion:nil];
}