简体   繁体   中英

How to get the window back with code after Reachability (double-tap home) triggered on iPhone 6?

Double-tap on iPhone 6's home button will shift the window down to let user can reach the top of the window. Tap into a UITextField(show inputView ) or show UIActionSheet can let the window get back.

So is there a line of code can get the window back without showing an extra view ?

There seems to be no public way to achieve what you're asking for yet.

Digging a little bit deeper we can find UIApplication 's private method called _deactivateReachability made exactly for this problem. You can call it this way:

[[UIApplication sharedApplication] performSelector:NSSelectorFromString(@"_deactivateReachability")];

But keep in mind that this solution will probably get your app rejected during the app review because of the usage of private undocumented API and it's better to wait when Apple will make public API for this feature.

Swift版本的Ilya的答案:

UIApplication.shared.perform(Selector(("_deactivateReachability")))

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