FAQ Database Discussion Community


Adjust UIActivityIndicatorView position in AlertView - Swift

ios,swift,uialertview,uiactivityindicatorview
I've been trying to adjust the position of IndicatorView inside UIAlertView, but it never works. i tried to set for loadingIndicator loadingIndicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50) but it didn't apply at all, take a look on this photo : alert = UIAlertView(title: "Loading...", message: nil , delegate:...

How can I display an UIAlertView as full screen in iOS?

ios,objective-c,iphone,uialertview
How can I display an UIAlertView as full screen in iOS ? Am very problem some times pop up tableview. So using alertview displaying tableview is easy but it is not expandng size. For that how can dispaly alertview in full screen in iOs ?

UiAlertView or UiAlertController to display only once in Swift

swift,uialertview,uialertcontroller
How can I get my UiAlertController or UIAlertView to display only once in Swift? override func viewDidLoad() { var defaults: NSUserDefaults = NSUserDefaults.standardUserDefaults() if let nameIsNotNill = defaults.objectForKey("name") as? String { self.name.text = defaults.objectForKey("name") as String } if let phoneIsNotNill = defaults.objectForKey("phone") as? String { self.phone.text = defaults.objectForKey("phone") as String...

Swift: Problems with getting text from UIAlertView textfield

ios,swift,alert,uialertview,textfield
I'm using Swift with Xcode 6.3. In my application I want a alert with a textfield. After clicking on "Done" I want to save the textfield input in a String. After clicking on "Cancel" I want only to close the alert. I've created my alert like this: var alert =...

How to display an UIAlertView after a iOS push notification everywhere except in one view

ios,swift,push-notification,uialertview
I'm trying to do a little messenger, I would like to display an alert saying that a new message has been received everywhere on the app except on the conversation itself. For now my alert is displayed everywhere, is it possible to filter it so it is not displayed on...

how to color specific words in a uialertview or UIAlertController ? (SWIFT)

ios,colors,uialertview
is there a way to color some specific words in uialertview ? I mean, can I color the word RED as red and at the same time GREEN as green ? Can someone bring me on the right way? ...

Swift: The tableView do not reload data after press button in alert view

ios,uitableview,swift,ios7,uialertview
I have add the alert view which let user to control that they can delete the all items in their database, but the table do not reload the data again. I have tried self.tableView.delegate = self and self.tableView.reloadData(), but it does not work. Here is the code: class ItineraryViewontroller: UITableViewController...

How to detect whether UIAlertView is currently showing

ios,objective-c,uialertview,uialertcontroller
Is there any way to judge whether there is currently a UIAlertView instance showing? Because it is possible to show multiple UIAlertView in the same window level. if ([self isAlertViewShowing]) { // do not show UIAlertView again. } else { // show your UIAlertView. } Hope there is such a...

Get the top ViewController in iOS Swift

swift,uialertview,viewcontroller,uiwindow
I want to implement a separate ErrorHandler class, which displays error messages on certain events. The behavior of this class should be called from different other classes. When an error occurs, it will have an UIAlertView as output. The display of this AlertView should ALWAYS be on top. So no...

Strong reference to `self` to keep the object alive (temporarily): evil?

ios,objective-c,automatic-ref-counting,uialertview,object-lifetime
I'm creating a wrapper for UIAlertView (I know about UIAlertController and about several already existing wrappers, it's also for educational purposes). Suppose it looks like this (very shortened version): @interface MYAlertView : NSObject -(void)show; @end @interface MYAlertView()<UIAlertViewDelegate> @end @implementation MYAlertView -(void)show { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Some title" message:@"Some...

How to dismiss UIAlertController when tap outside the UIAlertController?

ios,uialertview,uialertcontroller
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....

'NSInternalInconsistencyException' ?'The layout constraints still need update after sending

ios,ipad,crash,runtime-error,uialertview
I am facing a problem, i have a forgot password option in which i have placed a uialertview with input field. UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Forgot Password?" message:@"Please enter your username to retrieve password" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil]; [alertView setAlertViewStyle:UIAlertViewStylePlainTextInput]; [alertView show]; when app is launch it works fine...

UIAlertView after MOC background save works iOS 7 not iOS 8

ios,uitableview,ios8,parent-child,uialertview
I have a parent detail view controller that provides common custom functions to child detail views. The parent includes two custom functions. One function triggers a background save to two NSManagedObjectContexts that saves a main MOC immediately to free up UI, then saves a private MOC. Fairly standard setup pre...

How to show the image via http url in AlertView in Objective-C?

ios,objective-c,uiimage,uialertview,nsurl
I am developing in Objective-C , and I want to show the image via http url in AlertView ? I already get the image url like:http://192.72.1.1/DCIM/100__DSC/SNAP0053.JPG , and convert the NSURL to NSString. But I can not show the image in AlertView , it is empty. The code for convert...

How do I enter text in an alert textfield using Xcode UI Automation testing

ios,xcode,testing,uialertview
This problem is really bugging me. Having read the official documentation, the book by Jonathan Penn and all the online tutorials I can find. I have built a really simple app to learn about UI Testing but am getting stumped at the first step. Its a todo list app. I...

UIAlertView + UITextView [duplicate]

objective-c,uitextview,uialertview
This question already has an answer here: iOS UIAlertview with uitextview editable 1 answer I'm looking for some help. I need to know how to achieve multiline text input on a UIAlertView. I'm not looking to use a UITextField, that has single line input. Before UIAlertViews were deprecated I...

Create a shake animation for a UIAlertView

ios,objective-c,animation,uialertview
I'm trying to make a UIAlertView shake. I already made the alertView to stay on button click, but the shake animation is not working. Here is what I have: - (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 1) { self.direction = 1; self.shakes = 0; [self shake:aUIView]; } }...

App rotates when UIAlertView is shown in iOS 8

ios,iphone,uiviewcontroller,ios8,uialertview
I am working on an app that is mostly used in portrait mode (except for a few views). We are encountering an issue in iOS 8 where the app is able to rotate when an UIViewAlert is shown, even though the underlaying view controller only supports portrait orientation and its...

Uialtertview -> Insert String -> Segue How?

ios,swift,segue,uialertview
I am trying to do this sequence Tap a button Display an UiAltertView with textfield Press OK Copy the text inserted through the keyboard in another view With my actual code there is no segue,I don't understand why This is what i gat from the output when the uialertview appears:...

Calling UIAlertView on UITextField UIControlEventEditingDidBegin dismisses keyboard

ios,objective-c,uitextfield,uialertview
I've noticed some very weird behavior. I would like to show a UIAlertView when a UITextField is selected: [self.addressTextField addTarget:self action:@selector(addressTextFieldSelected) forControlEvents:UIControlEventEditingDidBegin]; The method that is being called is: - (void)addressTextFieldSelected { if (!geoPoint) { UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Text" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alertView show]; } }...

How do I validate TextFields in an UIAlertController?

ios,swift,uitextfield,uialertview
Can anyone tell me how to validate UITextFields inside of a UIAlertController? I need it to prevent the user from clicking "Save" unless both fields are entered. Here is my code so far: @IBAction func btnStart(sender: AnyObject) { var alert = UIAlertController(title: "New user", message: "Add a new user", preferredStyle:...

Indicator within alert, indicator doesn't show up (resolved using UIAlertController)

ios,objective-c,cocoa-touch,uialertview,uiactivityindicatorview
I'm trying to follow the accepted solution from here on Xcode 6.3.2 but the indicator refuses to show up or I can't see it on my iPhone 6 plus for some reason. No error messages, the alert with the title, etc shows up and empty space. What am I doing...

Unchecking a switch depending on user decision

ios,objective-c,uialertview,uilocalnotification,uiswitch
I'm building an app that asks the user for permission to post notifications when the user enables a switch. I'm using this code: - (IBAction)mySwitchValueChanged:(id)sender { if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){ [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]]; // ask the user for permission } if ([[UIApplication...

UIAlertView + TextField = Error?

ios,swift,uialertview
I am making a application so data can be saved to a Table View and I wanted to use the UIAlertView Controller in a way so people can use it to create a new Cell (task) but I know how to make a textField in a UIAlertView but how do...

Unable to Show/Display Custom Alert

ios,custom-controls,uialertview,modalviewcontroller
I found this cool looking "Custom Alert" iOS Control. But the problem is that, it is not working as it supposed to be. Whenever I tried to show the Alert. It seems to place an invisible overlay on top of my current view and causes the underlying it not to...

add UiPickerView into AlertController

ios,swift,uialertview,uipickerview
I am trying to create an alert message with built in UIPickerView in swift. After pressing the button "test" Picker should appear in alert window: The problem is only with data source for UIPickerView. It is empty: The project is published in my GIT repo. Can somebody advice on how...

How can a file be displayed using UIAlertview in iOS?

ios,uialertview
I am trying to display my license agreement the first time that the user run my application. The license agreement is around 3-pages long. Can I used an Alert to display this message? Does UIAlertView controller has a maximum number of characters that can be displayed?

UIAlertView save textfield.tex

ios,objective-c,uitextfield,uialertview
I want to replay an alertView with textfield until it will be canceled. The text in the textfield should be save in a NSMutableArray. I tried something, but it doesn't work. It will say by myNSMutableArray = ... EXPECTED identifier. What am I doing wrong? @synthesize myNSMutableArray; - (void)viewDidLoad {...

SWIFT - Add image to alert view

swift,uiimage,uialertview,uialertcontroller
I have an alert view that pops up when the user press the add button. How do i add an image to the alert view? I added some code that i took reference from stack overflow. My save button is replaced with the image and the image appear to be...

UIAlertView delay or not showing

ios,objective-c,uialertview
I have used UIAlertView several times without problems but this time I can't make it work correctly. The (simple) code is the following: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { alert = [[UIAlertView alloc]initWithTitle:@"" message:[NSString stringWithFormat: @"Reload data ?"] delegate:self cancelButtonTitle:@"Yes" otherButtonTitles:@"Cancel", nil]; [alert show]; NSLog(@"executed"); } If I touch in...

Change UIAlertView to UIAlertController of app to get updated to iOS 8

ios7,ios8,uialertview,deprecated,uialertcontroller
I have to update to iOS 8 some apps developed for iOS 7. After UIAlertView got deprecated on iOS 8. My question is: Is it neccesary to check the iOS version, and show a UIAlertController rather than a UIAlertView? Or can I leave the implementation of UIAlertView? Will iOS can...

Add multiple UITextfield in UIAlertview

ios,objective-c,xcode,uitextfield,uialertview
I need to put 5 UITextField in UIAlertView. I use this project: https://www.cocoacontrols.com/controls/aralertcontroller This is my code: ARAlertController *alert = [ARAlertController alertControllerWithTitle:@"My Alert" message:@"This is an alert." preferredStyle:ARAlertControllerStyleAlert]; ARAlertAction* defaultAction = [ARAlertAction actionWithTitle:@"OK" style:ARAlertActionStyleDefault handler:^(ARAlertAction * action) {}]; [alert addAction:defaultAction]; [alert presentInViewController:self animated:YES completion:nil]; Can someone...

My UIAlertView won't dismiss from MasterViewController of UISplitViewController

ios,uialertview,uisplitviewcontroller
I have the following code in my MasterViewController: override func viewWillAppear(animated: Bool) { super.viewWillAppear(false); let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate if((appDelegate.firstTime) != nil){ self.displayFirstTimeAlert() } } It dutifully displays the alert: func displayFirstTimeAlert(){ let message = "Please go to settings and set your preferred zipcode." let alertView = UIAlertView(title: "Welcome",...

IOS 8 can't dismiss keyboard from UITextField

ios,ios8,uitextfield,uialertview
I believe my issue is similar to: iOS 8 Keyboard Dismissed delay after modal view controller is dismissed but I'm unclear from the other thread how to work around it in my application. In Xcode5/IOS7, I show a UIAlertView with 2 UITextFields. The user can simply press OK and move...

Making UIAlertView a popOverView

ios,objective-c,uialertview
I have a UIAlertView, but I would like it to display like this: Not on the bottom like this: Please Note: I will only have text, not any buttons. Here is my code: - (IBAction)myButton:(id)sender { UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:@"Hello" message:nil preferredStyle:UIAlertControllerStyleActionSheet]; [self presentViewController:alertCtrl animated:YES completion:nil]; } I probably...

UITextField Editing Did Begin called on view endEditing

ios,objective-c,uitextfield,uialertview
This all works in my version that's on app store. However if I revert my git to that, it no longer works. It might be since I updated Xcode (now 6.3) but not sure. The issue is: I show a UIAlert when my UITextField 'Editing Did Begin' handler is called....

How to dismiss alert view after a successful NSURL connection

ios,objective-c,nsurlconnection,uialertview,uiactivityindicatorview
I have an UIAlertView with the UIActivityIndicatorView. UIAlertView *alertView_Spinning = [[UIAlertView alloc] initWithTitle:@"Please wait" message:@"Connecting to server" delegate:nil cancelButtonTitle:nil otherButtonTitles: nil]; alertView_Spinning.tag=0; UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; [indicator startAnimating]; [alertView_Spinning setValue:indicator forKey:@"accessoryView"]; [alertView_Spinning show]; How can I dismiss this...

UIAlertView (or LMAlertView) with two stacked buttons

ios,objective-c,uialertview
How can I create an UIAlertView with two stacked button? Instead of two buttons side by side? In my project I also use LMAlertView (GitHub repository) and I thought it would support them, but I can't find a way to obtain that very UIAlertView style. Currently I create a UIAlertView...

UIAlertView button text changing

swift,button,uialertview,rename
After choosing line from side menu, I'm calling alertView (for iOS7) with this code: var choiceAlert: UIAlertView = UIAlertView() choiceAlert.title = "Direction" choiceAlert.message = "Select a direction for no. \(lineNmb)." choiceAlert.addButtonWithTitle(dirA) choiceAlert.addButtonWithTitle(dirB) choiceAlert.addButtonWithTitle("Cancel") choiceAlert.delegate = self choiceAlert.tag = 3 choiceAlert.show() When I'm calling it for the first time, everything is...

how to display UIAlertView inside sendAsynchronousRequest's completionHandler?

ios,uialertview,sendasynchronousrequest
I am developing a login application. I have a registration view, I'm using sendAsynchronousRequest to send registration request.When I received a data back I want to show alert view displaying the registration if valid. Now my problem is When I received a data back the UI get blocked until alert...

UIAlertView showing while app receive a remote notification

ios,notifications,uialertview
I'm using parse.com to have remote notification in my app. The app is working fine and all code is correct and the view are created well. I wrote code to display me an UIAlertView when the phone receive a remote notification and the app is active. When the app receive...

checkbox in uialertview in ios8

ios,iphone,checkbox,uialertview,uialertcontroller
I want to add checkbox exactly as the below image below is my code: UIButton *nameField = [[UIButton alloc] initWithFrame:CGRectMake(120, 0, 30, 30.0)]; UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 250, 50)]; [v setBackgroundColor:[UIColor clearColor]]; [nameField setImage:[UIImage imageNamed:@"unchecked.png"] forState:UIControlStateNormal]; [v addSubview:nameField]; UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Delete selected pods from...

When replicating UIAlertView; background is not the same

ios,objective-c,uiview,uialertview
I'm creating a custom UIAlertView (from a UIView). I'm trying to get the same background effect (when the background view darkens). So I created a new black UIView with .5 opacity, and added it to the background. The problem is, I have a tab bar. When the black UIView covers...

Why is ActivityViewController displaying auto constraint errors in console?

ios,swift,uialertview,xcode7,ios9
I'm trying to implement a share button in my application and so naturally, I turned to UIActivityViewController. For some reason, any time I press the share button and it pops up, I get the following message in my log: Unable to simultaneously satisfy constraints. Probably at least one of the...

UiAlertView should change ViewController

ios,objective-c,uiviewcontroller,uialertview
What is wrong with following code? I will change the viewController, when the text in the alertView is not empty. The problem is, it will change the UiViewController every time, even it is empty. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (buttonIndex == 0) { if ([[alertView textFieldAtIndex:0].text isEqual:@""]) { UIAlertView *alert...

Using Custom UIAlertView xCode - Including Dialog/Text?

c++,cocoa-touch,uialertview
So I've been searching for a good way to include images and additional stuff into UIAlertViews in iOS 8. I eventually found this answer, which uses this custom class from Github which someone kindly uploaded. It works great and looks amazing, but I'm not sure how you actually include dialog...