如何显示警报时,应用程序在IOS
问题描述:
当我的应用程序在前台运行被关闭,如果用户点击主页按钮我想告诉喜欢如何显示警报时,应用程序在IOS
一些警告不要ü想退出该应用程序是/没有按钮。是否有任何代表方法被称为当主页按钮被点击时...
谢谢...。
答
在iOS上没有办法做到这一点。我想你想要一个类似于Android后退按钮的行为。
将iOS主页按钮想象成Android主页按钮,它不会让您提示用户。
+1
是的,我想要类似的行为,如android,我也搜索了它没有发现任何信息,感谢您的确认.. –
答
可以在使用这些方法AppDelegate.m
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
不,你不能这样做,在iOS中。有一个代表通知,但您的应用程序将立即转到后台。 – KudoCC
无论如何,你绝对不应该这样做。如果用户点击主页按钮,他们想要离开您的应用程序。您的业务无一为何,而且您无权干涉用户的行为。除非你想要1星评价(假设0星是不可能的)。 – gnasher729
请花一点时间接受答案(点击复选标记)。你也可以投票的答案,因为有几个人试图帮助你:) – 2015-08-29 06:39:53