uialertview

iOS: Custom permission alert view text

二次信任 提交于 2019-11-27 04:06:26
Anyway to custom permission alert view like: Contacts, Photo Album, Push Notifications... before they get access, they will pop up an alert view like this: How to custom Contacts, photo album, push notifications alert view text? UPdate: See the update image above, translate into english: "To seek for your family and friends, Path needs to transfer your contacts to our server" And click OK to get contacts access without any other access permission alert view pops up. rmaddy Under iOS 6 and above, these can be setup to show specific messages. Edit your Info.plist by adding a few new entries. The

AlertController is not in the window hierarchy

陌路散爱 提交于 2019-11-27 03:50:00
I've just created a Single View Application project with ViewController class. I would like to show a UIAlertController from a function which is located inside my own class. Here is my class with an alert. class AlertController: UIViewController { func showAlert() { var alert = UIAlertController(title: "abc", message: "def", preferredStyle: .Alert) self.presentViewController(alert, animated: true, completion: nil) } } Here is ViewController which executes the alert. class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } @IBAction func showAlertButton

UIAlertView is Not Working in Swift

好久不见. 提交于 2019-11-27 02:59:28
问题 when i runt this code in swift, i dont know why the app terminates by showing a break point in the "alertView.show()" part, Somebody please help me. var alertView = UIAlertView( title: "Hey", message: "Hello", delegate: self, cancelButtonTitle: "Cancel" ) alertView.show() 回答1: From Xcode 6.0 UIAlertView class: UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead. On swift ( iOS 8 and OS X 10.10 ), you can do this: var alert =

UIAlertView like “Turn On Location Services to allow maps to determine your location”. Settings + Cancel

这一生的挚爱 提交于 2019-11-27 02:01:40
问题 I Want to emit this alert: Turn On Location Services to allow maps to determine your location I need both "Settings" and "Cancel" exactly like the "maps" application. "Settings" should open settings->general->location services I didn't find the way to open the settings page. Can you help me? Thanks 回答1: Creating the alert is pretty straightforward, it's just a (faux-)modal UIView. However, it's not possible to open the Settings app programmatically, at least not without using private methods

Custom Alert (UIAlertView) with swift

北战南征 提交于 2019-11-27 01:09:44
How can i create a custom alert with Swift? I try translating a guide from Objective c but loads a full screen layout for do it easy i can load a new layout with the transparent background i try this: listaalertviewcontroller.view.backgroundColor = UIColor.clearColor() let purple = UIColor.purpleColor() // 1.0 alpha let semi = purple.colorWithAlphaComponent(0.5) listaalertviewcontroller.view.backgroundColor = semi presentingViewController.modalPresentationStyle = UIModalPresentationStyle.CurrentContext self.presentViewController(listaalertviewcontroller, animated: true, completion: nil) in the

UIAlertController is moved to buggy position at top of screen when it calls `presentViewController:`

為{幸葍}努か 提交于 2019-11-27 01:01:59
问题 Presenting a view from a UIAlertController moves the alert to a buggy position at the top-left corner of the screen. iOS 8.1, device and simulator. We have noticed this in an app when we attempt to present a view from the current "top-most" view. If a UIAlertController happens to be the top-most view we get this behavior. We have changed our code to simply ignore UIAlertControllers, but I'm posting this in case others hit the same issue (as I couldn't find anything). We have isolated this to

UIAlertView/UIAlertController iOS 7 and iOS 8 compatibility

女生的网名这么多〃 提交于 2019-11-27 00:05:16
I am using Swift to write an app and I need to show an alert. The app must be iOS 7 and iOS 8 compatible. Since UIAlertView has been replaced with UIAlertController , how can I check if the UIAlertController is available without checking the system version? I have been hearing that Apple recommends that we should not check the system version of the device in order to determine the availability of an API. This is what I am using for iOS 8 but this crashes on iOS 7 with " dyld: Symbol not found: _OBJC_CLASS_$_UIAlertAction " : let alert = UIAlertController(title: "Error", message: message,

Can I get message when I show UIAlertView

久未见 提交于 2019-11-26 23:32:49
问题 I want to get message when system show UIAlertView so I can pause my game. Anyone know how to figure out that? The UIAlertView is not controlled by myself. 回答1: Application delegate's applicationWillResignActive: will be called on interrupts. You can handle the pause there or you can even listen to the UIApplicationWillResignActiveNotification in your view controller and pause the game there. You can look at this part of the iOS Application Guide that details the life cycle of the application

How can I schedule local notification for the following scenario?

狂风中的少年 提交于 2019-11-26 22:47:48
问题 Experts, I have a scenario wherein I need to notify user three times a day (morning, afternoon, evening). And the timings for these notifications will be different for each day, based on database values for each date. These three notifications are configurable. Meaning user might just choose to set afternoon and evening while turning off morning notification under settings. As per my understanding I can achieve this using local notifications. I can do the following: - before the application

Writing handler for UIAlertAction

被刻印的时光 ゝ 提交于 2019-11-26 21:47:55
I'm presenting a UIAlertView to the user and I can't figure out how to write the handler. This is my attempt: let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title: "Okay", style: UIAlertActionStyle.Default, handler: {self in println("Foo")}) I get a bunch of issues in Xcode. The documentation says convenience init(title title: String!, style style: UIAlertActionStyle, handler handler: ((UIAlertAction!) -> Void)!) The whole blocks/closures is a little over my head at the moment. Any suggestion are