uialertview

Fetching JSON data after failed retrieval

血红的双手。 提交于 2019-12-02 11:28:52
In my application, I am fetching JSON data. Occasionally, the application will fail to fetch it and when I print the responseObject, it returns ( ). I would like to make an if statement so that when this happens, a UIAlertView will show up. Right now, I have an if statement saying that if self.jobs == nil, the alert will come up, but that is not working. I'd really appreciate any help! - (void)viewDidLoad { [super viewDidLoad]; //Fetch JSON NSString *urlAsString = [NSString stringWithFormat:@"https://jobs.github.com/positions.json?description=%@&location=%@", LANGUAGE, TOWN]; NSURL *url =

clickedButtonAtIndex method is not called

末鹿安然 提交于 2019-12-02 11:24:45
when the user click on a button on the UIAlertView the clickedButtonAtIndex method is supposed to be called, however, it doesn't : in the .h i have called the UIAlertView protocol : @interface RechercherViewController : UIViewController<UIAlertViewDelegate> { //code } and in .m file i have this : -(void)requestFailed:(ASIHTTPRequest *)request { //quand il y aura un échec lors de l'envoie de la requête UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"TopStation" message :@"Your internet connexion is down" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert

Create a shake animation for a UIAlertView

孤街浪徒 提交于 2019-12-02 10:41:17
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]; } } -(void)shake:(UIAlertView *)theOneYouWannaShake { [UIView animateWithDuration:0.03 animations:^ { theOneYouWannaShake.transform = CGAffineTransformMakeTranslation(5 * self.direction, 0); } completion:^(BOOL finished) { if(self.shakes >= 10) { theOneYouWannaShake

UIAlertView not functioning correctly

微笑、不失礼 提交于 2019-12-02 09:23:23
I have a problem when I try to dismiss my UIAlertView. The UIAlertView launches correctly, and displays two buttons: "Yes" and "No". However, when I select the Yes button, nothing happens. I am wondering what I am doing wrong, and why nothing occurs when the Yes button is selected. My code is as follows: -(IBAction)gotoURL { [self displaySafariDialogue]; } -(void)displaySafariDialogue { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Are you sure you wish to exit this app and launch the safari browser?" message:@"Click yes to continue" delegate:nil cancelButtonTitle:@"Yes"

Setting UIAlertView button's color in swift

旧时模样 提交于 2019-12-02 09:04:30
问题 i'm a new swift programmer and i need to change the color of my UIAlertView's button's color. for example i want to change the UIColor of that to yellow. can you help me please? 回答1: You can change the tintColor like so: alert.view.tintColor = UIColor.blackColor() But customizing a UIAlertView is frowned upon by Apple. The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified. UIAlertView Class

UIAlertView: wait_fences: failed to receive reply: 10004003

半腔热情 提交于 2019-12-02 08:27:17
问题 I'm running a web request in the background and I want the user to be able to cancel this request. I use a UIActionSheet with a Cancel button while the web request is running. When the web request returns an error, I close the UIActionSheet by calling DismissWithClickedButtonIndex(0, true). Then I show a UIAlertView with an error message and the option to cancel or retry the web request. Everything works fine most of the time, but sometimes I get the "wait_fences: failed to receive reply:

How Add Image into UIAlertbox in Swift 3?

我只是一个虾纸丫 提交于 2019-12-02 08:10:10
I would like to add Image in UIAlertbox so I add the following codes. let alertController = UIAlertController(title: "Gender", message: "" , preferredStyle: .alert) // Create the actions let okAction = UIAlertAction(title: "Female", style: UIAlertActionStyle.default) { UIAlertAction in // exit(0) debugPrint("Press OK") } let cancelAction = UIAlertAction(title: "Male", style: UIAlertActionStyle.cancel) { UIAlertAction in } // Add the actions okAction.setValue(#imageLiteral(resourceName: "female_image"), forKey: "image") cancelAction.setValue(#imageLiteral(resourceName: "male_image"), forKey:

how can I have a totally transparent UIAlertView?

落爺英雄遲暮 提交于 2019-12-02 08:08:11
I need a UIALertView, which on popping up should be transparent enough to show the background behind the alertview in a faded way and the blue color of the alert view should not appear since the background behind the alert view is black and grey in color. Changing color and putting an image to the alert view is one thing which can be seen in the links : iOS 5 black transparent UIAlertView and Changing the background color of a UIAlertView? but I need a transparent UIAlertView. Is it possible to get one?If yes how? Thanks for the help in advance. If you look at Apple's documentation page for

UIAlertView: wait_fences: failed to receive reply: 10004003

情到浓时终转凉″ 提交于 2019-12-02 07:14:05
I'm running a web request in the background and I want the user to be able to cancel this request. I use a UIActionSheet with a Cancel button while the web request is running. When the web request returns an error, I close the UIActionSheet by calling DismissWithClickedButtonIndex(0, true). Then I show a UIAlertView with an error message and the option to cancel or retry the web request. Everything works fine most of the time, but sometimes I get the "wait_fences: failed to receive reply: 10004003" message in the console output window and incidentally there is some strange UI-behaviour. I did

how to add checkbox into uialertview?

六月ゝ 毕业季﹏ 提交于 2019-12-02 05:36:11
问题 I'm new in iPhone development. I want to add a check box into an alert view. I'm doing tests on this alertview for the last two days, but do not get any working demo project. I want exactly this alertbox! Can anyone help me? 回答1: try this code for add checkbox in alertview . UIButton *nameField = [[UIButton alloc] initWithFrame:CGRectMake(0.0, 0, 50, 50.0)]; UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 250, 40)]; [nameField setImage:[UIImage imageNamed:@"checkbox_off.png"]