Typically, the user taps a
Done button to dismiss a modal view. You can create an action method for the
Done button that contains the following code that dismisses the view controller, which in turn hides the view.
In Swift:
@IBAction func done(sender: AnyObject) {
self.dismissViewControllerAnimated(true, completion: nil)
}
In Objective-C:
- (IBAction)done:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
To see this code in action, check out Book 3: Navigating Xcode 5, in Chapter 7: The User-Interface Controls under the section "Switching Between Standard, Satellite, and Hybrid".
All the best!
Kevin
Author of Learn to Code in Swift:
https://itunes.apple.com/us/book/learn-to-code-in-swift/id942956811?mt=11