You can try NSUserDefaults to store your data from textview and then read them back for the label.
EDIT: If you don't want to use NSUserDefaults as it's not the "right" way (but the easy one) you can try this:
In your tableViewController.h create a NSString:
#import <UIKit/UIKit.h>
@interface TestTableViewController : UITableViewController
@property (nonatomic, strong) NSString *string;
@end
In your viewController.h that contains the textView add these:
- (IBAction)doneButton;
@property (weak, nonatomic) IBOutlet UITextView *textView;
In viewController.m:
- (IBAction)doneButton {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
TestTableViewController *tvc = (TestTableViewController*)[storyboard instantiateViewControllerWithIdentifier:@"TestTableViewController"];
tvc.string = _textView.text;
[tvc setModalPresentationStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:tvc animated:YES];
// ios6 version:
//[self presentViewController:tvc animated:YES completion:nil];}
Then back in your tableViewController.m display the input data to your cell (you don't need to use a label):
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"test";
UITableViewCell *cell = [[UITableViewCell alloc] init];
if (SYSTEM_VERSION_LESS_THAN(@"6.0")) {
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; }
else {
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
}
// Configure the cell...
cell.textLabel.text = _string;
return cell;}
DON'T forget to set the Storyboard ID to identity inspector on storyboard for your tableViewController!!