uialertaction

How to present UIAlertController from SKScene

廉价感情. 提交于 2019-12-20 03:14:51
问题 I'm working in Spritekit and I'm trying to present a UIAlertController from my SKScene, but I am having trouble doing it. I've watched several tutorials but none of the UIAlertController tutorials have been specific to Spritekit. I keep seeing this code below, but it has not been effective since SKScene is not a UIViewController. [self presentViewController:self animated:YES completion:nil]; I have the rest of the relative code below. Can anybody please help me present my UIAlerController on

Cropped characters - iOS11 - Alert Dialog

↘锁芯ラ 提交于 2019-12-19 11:58:07
问题 Cropped characters - iOS11 - Alert Dialog. How to fix it? [ func settingsButtonPressed() { let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) let closeAction = UIAlertAction(title: "Anuluj", style: .cancel) { (action) in //do nothing } alert.addAction(closeAction) let restorePurchases = UIAlertAction(title: "Przywróć zakupy", style: .default) { (action) in self.restorePurchases() } alert.addAction(restorePurchases) let refreshCatalogs = UIAlertAction(title:

Is it possible to set custom font & size for NSString?

走远了吗. 提交于 2019-12-19 11:56:25
问题 I'm working with Swift in iOS 9. I want to customize the font for a UIAlertAction . I searched these questions for a Swift answer: Change the Font of UIAlertAction in Swift Is it possible to customize the font and appearance of a UIAlertController in the new XCode w/ iOS8? And this question for an Objective-C answer: UIAlertController custom font, size, color But there was no solution for customizing the font for a UIAlertAction . I believe the problem is that a UIAlertAction uses an NSString

How to change font size and color of UIAlertAction in UIAlertController

左心房为你撑大大i 提交于 2019-12-19 04:14:58
问题 In the image above how to change the font size and color of "Done", "Some Other action"? and how to change the font size and color of "title", and "message"? Thank you. 回答1: This is from another stack overflow post but seems to work fine. Post found here. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Dont care what goes here, since we're about to change below" message:@"" preferredStyle:UIAlertControllerStyleActionSheet]; NSMutableAttributedString *hogan = [

Objective C - I would like UIAlertController to not be removed when button clicked

不打扰是莪最后的温柔 提交于 2019-12-13 13:00:25
问题 I would like to present a UIAlertController with 2 buttons. One button should close the alert and the second should perform an action but remain the alert on screen. Is there some configuration that can be done to action that it won't close the alert? UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert]; [alert addAction:[UIAlertAction actionWithTitle:@"Do Something" style:UIAlertActionStyleDefault

NSMutableAttributedString as UIAlertAction's title - Swift

ε祈祈猫儿з 提交于 2019-12-11 18:27:41
问题 Is it possible to set a NSMutableAttributedString as AlertAction's title? My aim is to visualize a math expression with a good design in my UIAlertAction's title. let action = UIAlertAction(title: myNSMutableAttributedString, style: UIAlertActionStyle.default) {(result : UIAlertAction) -> Void in } Thanks in advance for the help. 回答1: It's not possible to use an NSAttributedString for a UIAlertAction 's title without accessing private APIs, as the method for setting the attributedTitle to an

Updating UILabel from UIAlertAction handler not working in Swift 4

妖精的绣舞 提交于 2019-12-11 15:17:35
问题 I have a subclass of UITableView in my iOS app (Swift 4, XCode 9). This table has one row and I want it to display an alert when it's clicked, get some input from the user, and then update a label ( lblUserFromPrefs ) in the table when the user clicks "OK" in the alert. Currently everything works fine except the label doesn't get updated. Here is the relevant code from my UITableView subclass: override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print(

Centering an image in UIAlertAction in UIAlertController

别等时光非礼了梦想. 提交于 2019-12-11 09:41:47
问题 I am currently adding images to UIAlertAction with the following code (Swift). purpleAction.setValue(pCircle, forKey: "image") I want to centre the image in the UIAlertAction if possible. Currently the UIAlertAction has a title that is in the centre, and the image appears on the left hand side. 回答1: You cannot change the frame of image, you need to build custom alertView for your issue. 回答2: You can actually hack this with imageWithAlignmentRectInsets: UIAlertController *ac =

Select text in UIAlertController's text field

这一生的挚爱 提交于 2019-12-10 03:34:38
问题 I need the text of the text field to be selected right after the UIAlertController is presented. However, the way I select text in a standard UITextField doesn't work here. This is what I tried, but I can't seem to get it work. let ac = UIAlertController(title: "Rename", message: nil, preferredStyle: .Alert) ac.addTextFieldWithConfigurationHandler({ [] (textField: UITextField) in textField.selectedTextRange = textField.textRangeFromPosition(textField.beginningOfDocument, toPosition: textField

The handler of a UIAlertAction is a bit too late - how can I make it immediate?

孤者浪人 提交于 2019-12-07 12:29:21
问题 I am trying (...) to add a sound effect to the buttons added to a UIAlertController. I fire a sound effect in the handler, but this actually is a bit too late. The sound fires like 0.5 seconds too late. I want the sound to fire as soon as the alert is about to dismiss, not after it has dismissed. With UIAlertView this was possible to handle using alertWillDismiss... rather than alertDidDismiss. Did I miss something? 回答1: No, you didn't miss anything. The functionality you're looking for is