uialertcontroller

How to dismiss UIAlertController when tap outside the UIAlertController?

可紊 提交于 2020-01-26 18:59:24
问题 How to dismiss UIAlertController when tap outside the UIAlertController ? I can add a UIAlertAction of style UIAlertActionStyleCancel to dismiss the UIAlertController . But I want to add the function that when user tap outside the UIAlertController the UIAlertController will dismiss. How to do that? Thank you. 回答1: Add a separate cancel action with style UIAlertActionStyleCancel . So that when user taps outside, you would get the callback. Obj-c UIAlertController *alertController =

How to dismiss UIAlertController when tap outside the UIAlertController?

萝らか妹 提交于 2020-01-26 18:58:09
问题 How to dismiss UIAlertController when tap outside the UIAlertController ? I can add a UIAlertAction of style UIAlertActionStyleCancel to dismiss the UIAlertController . But I want to add the function that when user tap outside the UIAlertController the UIAlertController will dismiss. How to do that? Thank you. 回答1: Add a separate cancel action with style UIAlertActionStyleCancel . So that when user taps outside, you would get the callback. Obj-c UIAlertController *alertController =

iOS Push Notification Custom Alert

ε祈祈猫儿з 提交于 2020-01-24 17:33:05
问题 I am trying to enable push notifications in my iOS app. I wanted to create a custom alert to ask the user if they want to enable the notifications. Does apple allow this/possible to implement? Thanks 回答1: When you register for notifications, a popup will appear asking the user for permission (unless he/she already gave permission before): The first time you call the registerUserNotificationSettings: method, iOS presents a dialog that asks the user for permission to present the types of

How can I override convenience init in UIAlertController for swift?

て烟熏妆下的殇ゞ 提交于 2020-01-23 08:32:49
问题 I'm trying to override convenience init in UIAlertController, but it gives me an error like 'initializer does not override a designated initializer from its superclass'. How can I override it using inheritance or extension whatever? My codes are below. import UIKit class ColorAlertViewController: UIAlertController { override func viewDidLoad() { super.viewDidLoad() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } override convenience init(title: String?, message:

Return from Safari to IOS application with UIAlertView

五迷三道 提交于 2020-01-17 06:36:29
问题 I opened a link in safari browser, its a web page for online Payment, I want to do is that when user press cancel button on webPage then it will show alert view in safari and come back to application and when user press ok then it open iOS application again, I do not have any reviews for this. I need help about this. 来源: https://stackoverflow.com/questions/41891144/return-from-safari-to-ios-application-with-uialertview

showing action sheet in the custom cell in Swift

馋奶兔 提交于 2020-01-14 03:46:10
问题 I have a custom cell that contains a button inside it, I want to show an action sheet when the button is pressed, but as u know , UITableViewCell is doesn't have the method "presentViewController", so what should I do? 回答1: In your custom cell's swift file, write a protocol to be conformed by your viewContoller, // your custom cell's swift file protocol CustomCellDelegate { func showActionSheet() } class CustomTableViewCell : UITableViewCell { var delegate: CustomCellDelegate? // This is the

UIAlertController Action Sheet without Blurry View Effect

ぐ巨炮叔叔 提交于 2020-01-13 04:41:08
问题 I'm using UIAlertController for some actions. But I'm not a big fan of the Blurry View Effect in the actions group view (see screenshot below). I'm trying to remove this blurry effect. I made some research online, and I couldn't find any API in UIAlertController that allows to remove this blurry effect. Also, according to their apple doc here : The UIAlertController class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not

Warning: UIAlertController is already presenting

人盡茶涼 提交于 2020-01-12 07:19:07
问题 I am a novice in swift and XCode so please forgive me the probably really messy code! When running my code I get the following warning: Warning: Attempt to present on which is already presenting I have already checked the forum and found a post regarding that issue....I applied the help suggested as in: if presentedViewController !== nil { self.presentViewController(alertController, animated: true, completion: nil) } else{ self.dismissViewControllerAnimated(false, completion: nil) self

Prevent dismissal of UIAlertController

☆樱花仙子☆ 提交于 2020-01-08 16:04:29
问题 I am adding a UITextField to a UIAlertController , which appears as an AlertView . Before dismissing the UIAlertController , I want to validate the input of the UITextField . Based on the validation I want to dismiss the UIAlertController or not. But I have no clue how to prevent the dismissing action of the UIAlertController when a button is pressed. Has anyone solved this problem or any ideas where to start ? I went to google but no luck :/ Thanks! 回答1: You're correct: if the user can tap a

Change UIActionSheet buttons background color and button font

左心房为你撑大大i 提交于 2020-01-06 19:30:32
问题 I have a UIActionSheet in my application. I want to change the background color of actionsheet buttons and the font of the buttons. I made a search found below code: for (UIView *_currentView in actionSheet.subviews) { if ([_currentView isKindOfClass:[UIButton class]]) { //DO YOUR WORK } } but this code is not working on ios 8. for ios I found below code too: [[UIView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[UIColor redColor]]; but this code only changes the