iOS: Hide Keyboard on App Did Enter Background or View Did Disappear?

0 votes
42 views
asked May 1 in Swift by anonymous
HI

  iOS: Hide Keyboard on App Did Enter Background or View Did Disappear?

1 Answer

0 votes
answered May 1 by admin (8,115 points)

HI 

 Objective-c

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [self.window endEditing:YES];
}

Swift3.0
 func applicationDidEnterBackground(_ application: UIApplication) {
        self.window?.endEditing(true)
 }

...