Passing an array from one view controller to the another view controller
I hav开发者_运维问答e read all of the posts about passing data from one view controller to another but I am still at a loss as to how that is done. Simply put, I have an array that is built in my MainViewController and need to use that array in my DisplayViewController.
I am simply doing the following
//DisplayViewController
self.items = mainViewController.items
I would think that this notation would work but I keep getting the following error: Request for member 'mainViewController' in something not a structure or union.
Since I am a real newbie I cannot really understand some of the answers that I read. So if someone can put it in laymans terms, I would really appreciate it!!!
Usually it's done the other way around. Just before you push your DisplayViewController on the stack (or however you make it visible), you set its items
property.
detailViewController.items = self.items;
[self.navigationController pushViewController:detailViewController animated:YES];
精彩评论