Parent view controller is a table of words. Child view segues on the screen and lets you play with that word. User can "flag" the word (which saves into user defaults). How should the parent table now find out that word has been flagged so we can display a pretty flag icon?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- Popover segue to static cell UITableView causes co
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
Using delegation is the best option. Make parent to be delegate of your child. No matter what data type you wanna use to pass, in your child VC, either your from your - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath() if you only allow one word to be select at a time or a button press function if you allow multiple selection. Call your delegate method to receive those words send from child, then you can do whatever you want with it.
Hope this helps.
To pass data back from child to parent view controller you need to use Protocols and Delegates
See Passing Data Back section of this SO accepted answer for detailed explanation about passing information back and forth between view controllers
You can have a
boolean
in the child view controller.You can set that boolean to true when the user "flags" it.
As shown above you can send back the value to the parent view controller whether it has been flagged or not.
Hope this helps.