简体   繁体   中英

iOS 6, StroryBoards: Updating UITextView on main scene after modal segue

I try to update UITextView text on parent scene after returning from child scene where an user can input the content that should appear after navigating back.

Parent scene:

在此处输入图片说明

Modal segue ->

在此处输入图片说明

Child

After navigating back the methods viewWillAppear or viewDidLoad are not getting called and thus this UITextView controller doesn't get feed with updated data. What is the most clever way to solve this problem. Thank you in advance.

EDIT:

-(void)viewWillAppear:(BOOL)animated
{
   [super viewWillAppear:animated];
   NSLog(@"Calling viewWillAppear");
// SQLite access methods and other bla bla bla
}

After getting back from child scene, viewWillAppear doesn't get called -> NSLog doesn't print out.

A modal segue like the one you are describing is technically on screen the whole time, so viewDidLoad and viewWillAppear are never called.

The best way to get the data from the modal view controller to your main view controller is to use delegation. Send the data back via an argument of a delegate method (defined in your own custom protocol). In the implementation of your delegate method, do all your SQLite calls, and call setNeedsDisplay , and store the value passed by the modal view controller any way you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM