uialertcontroller

Swift UIAlertController Getting Text Field Text

ⅰ亾dé卋堺 提交于 2019-12-01 05:58:20
I need to get the text from the text fields in my alert view when the Input button is pressed. func inputMsg() { var points = "" var outOf = "" var alertController = UIAlertController(title: "Input View", message: "Please Input Your Grade", preferredStyle: UIAlertControllerStyle.Alert) let actionCancle = UIAlertAction(title: "Cancle", style: UIAlertActionStyle.Cancel) { ACTION in println("Cacle") } let actionInput = UIAlertAction(title: "Input", style: UIAlertActionStyle.Default) { ACTION in println("Input") println(points) println(outOf) } alertController.addAction(actionCancle)

Accessing UIAlertControllers textField

本秂侑毒 提交于 2019-12-01 05:40:39
问题 I'm having trouble accessing an UIAlertController's textField from within a handler action, I think. I've googled the error but didn't get too much out of it. I'm using Swift with Xcode 6.0.1. Here's the error: '[AnyObject]?' does not have a member named 'subscript' @IBAction func addPressed(sender: UIBarButtonItem) { var alert = UIAlertController(title: "New Event", message: "Name of the event?", preferredStyle: .ActionSheet) alert.addTextFieldWithConfigurationHandler(){ textField in

UIActionSheet/UIAlertController multiline text

前提是你 提交于 2019-12-01 04:48:15
问题 This is the code I am writing to display UIActionSheet . actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"updateresponseforrecurring", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) destructiveButtonTitle:nil otherButtonTitles: NSLocalizedString(@"updateresponseonlyforthis", nil), NSLocalizedString(@"updateresponseforallactivities", nil), nil]; actionSheet.tag = 2; [actionSheet showInView:[UIApplication sharedApplication].keyWindow]; This is what

Swift UIAlertController Getting Text Field Text

孤街浪徒 提交于 2019-12-01 03:26:23
问题 I need to get the text from the text fields in my alert view when the Input button is pressed. func inputMsg() { var points = "" var outOf = "" var alertController = UIAlertController(title: "Input View", message: "Please Input Your Grade", preferredStyle: UIAlertControllerStyle.Alert) let actionCancle = UIAlertAction(title: "Cancle", style: UIAlertActionStyle.Cancel) { ACTION in println("Cacle") } let actionInput = UIAlertAction(title: "Input", style: UIAlertActionStyle.Default) { ACTION in

Every UIAlertController disappear automatically before user responds - since iOS 13

北战南征 提交于 2019-12-01 01:14:47
问题 Since I'm using iOS 13, each of my UIAlertController shows up for about half a second and disappears instantly before any user action. Any idea ? As I use UIAlertController from different parts of my app, I use an extension that allows me to pop up both from classical views and collectionView (cell, header etc...) public extension UIAlertController { func show() { let win = UIWindow(frame: UIScreen.main.bounds) let vc = UIViewController() vc.view.backgroundColor = .clear vc.view.tintColor =

create alert function in all view controllers - swift

被刻印的时光 ゝ 提交于 2019-12-01 00:47:37
I'm trying to declare a function for showing alerts in my app. To avoid repeating work, i'm trying to use same function for all my app. I tried to do that by creating a class with function showNotification. but when i create an object of that class and call the method, nothing happens. How can i do that? class SharedPropertiesAndMetods : UIViewController { func showNotification(title: String, message: String) { let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) let defaultAction = UIAlertAction(title: "تائید", style: .default, handler: nil)

How to change font size and color of UIAlertAction in UIAlertController

泪湿孤枕 提交于 2019-12-01 00:00:47
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. jimrice 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 = [[NSMutableAttributedString alloc] initWithString:@"Presenting the great... Hulk Hogan!"]; [hogan

How do I get the frame width of UIAlertController?

僤鯓⒐⒋嵵緔 提交于 2019-11-30 21:48:05
I'd like to get the width of UIAlertController frame so that I can specify the width of UIPickerView and UIToolbar which will come with the UIAlertController. I've tried to use the following statement to get the width. alertPicker.view.frame.size.width But, the width is as same as viewController's: self.view.frame.size.width Any idea to get the width of the UIAlertController? Thanks a lot. This is my code. UIAlertController *alertPicker = [UIAlertController alertControllerWithTitle:nil message:@"\n\n\n\n\n\n\n\n\n\n\n\n" preferredStyle:UIAlertControllerStyleActionSheet]; CGRect pickerFrame =

UI_06 UIControl及其子类

巧了我就是萌 提交于 2019-11-30 20:40:26
⼀、UISegmentedControl的使⽤ 分段控件。每个segment都能被点击,相当于集成了若干个button。 通常我们会点击不同的segment来切换不同的view。 1、常⽤⽅法和属性 initWithItems: //UISegmentedControl独有的初始化⽅法,⽤来创建多个分段 setTitle: forSegmentAtIndex: //为指定下标的分段设置title selectedSegmentAtIndex //(property)被选中的segment tintColor //(property)segmentedControl条的颜⾊(含每个segment的颜⾊) addTarget: action: forControlEvents://给UISegmentedControl添加事件, controlEvent //为UIControlEventValueChanged。 2、使用 RootViewController.m #import "RootViewController.h" #import "MessageViewController.h" #import "PhoneViewController.h" @interface RootViewController () @property ( nonatomic , retain )

How do I get the frame width of UIAlertController?

对着背影说爱祢 提交于 2019-11-30 17:11:26
问题 I'd like to get the width of UIAlertController frame so that I can specify the width of UIPickerView and UIToolbar which will come with the UIAlertController. I've tried to use the following statement to get the width. alertPicker.view.frame.size.width But, the width is as same as viewController's: self.view.frame.size.width Any idea to get the width of the UIAlertController? Thanks a lot. This is my code. UIAlertController *alertPicker = [UIAlertController alertControllerWithTitle:nil