uialertview

UIActivityIndicatorView not displaying right on UIAlertView

五迷三道 提交于 2019-12-23 10:25:40
问题 I am writing an iOS app, and I have to display a UIAlertView with a spinner. Sometimes , something goes wrong when I try to add the spinner in the center of the alert, usually when there was another alert right before this one (not exactly a rule, but this is how I noticed it fails). I partly solved this bug by delaying the creation of the spinner. Here is how I do it ( alert is a member UIAlertView) : This code is in viewDidLoad : alert = [[[UIAlertView alloc] initWithTitle:@"Loading..."

UIActivityIndicatorView not displaying right on UIAlertView

旧巷老猫 提交于 2019-12-23 10:24:06
问题 I am writing an iOS app, and I have to display a UIAlertView with a spinner. Sometimes , something goes wrong when I try to add the spinner in the center of the alert, usually when there was another alert right before this one (not exactly a rule, but this is how I noticed it fails). I partly solved this bug by delaying the creation of the spinner. Here is how I do it ( alert is a member UIAlertView) : This code is in viewDidLoad : alert = [[[UIAlertView alloc] initWithTitle:@"Loading..."

Check if the running code is unit test case or not

跟風遠走 提交于 2019-12-23 09:55:52
问题 I want to check if the running code is unit tese case or not execute different code for the result such as: if ( unit test case is running ) { do something } else { do other thing } any idea on this? 回答1: This is a bad approach you should try to simulate logic parts which you are trying to avoid by this statemetn through Mock ojects or other mechanism. Now to your question you can use a oolean variable like isUnittest which you set on test setup and Teardown, ut as saied i dont recommend you

when user click on particular date a alert will show with that event title

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 03:05:07
问题 I'm Using SAcalendar. this is my json: data: - [ - { id: "1", event_start: "2014-06-09 11:30", event_end: "2014-06-09 12:30", title: "Click a date to create a new event and drag to change its date and time. Click on an existing event to modify. Click "Show Standard Settings" to set additional event properties." }, - { id: "2", event_start: "2017-01-03 16:30", event_end: "2017-01-03 17:30", title: "fgdgf" }, - { id: "3", event_start: "2017-01-11 03:30", event_end: "2017-01-11 06:00", title:

UIAlertView button frames are all 0?

断了今生、忘了曾经 提交于 2019-12-22 18:35:13
问题 Is there a way for me to get a reference to the button frames in an alertView I created? I'd like to find the position of the top button so I can use its frame to position an image directly above it. I have a couple of extra \n's at the end of my alertview text to make sure there is room to place the image, but I need to determine where that free space is in the alertview. Using the top button as a reference seems like a reliable way to find it. I have tried the following, which does return

iOS 7: UIAlertView created in UIActionSheet delegate function cannot auto rotate

陌路散爱 提交于 2019-12-22 18:10:56
问题 The issue only can be reproduced in iOS 7. In the delegate function: - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex , if a UIAlertView is created, the alert view cannot auto rotate. Here is the sample code: - (IBAction)buttonTapped:(id)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"action sheet" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:@"ok" otherButtonTitles:nil]; [actionSheet showInView:self

Any non-private API alternative for this?

被刻印的时光 ゝ 提交于 2019-12-22 11:29:55
问题 My app was recently rejected due to using a private API ( addTextField: method for UIAlertView , which is quite useful, might I add). Is there any non-private alternative to UIAlertView 's undocumented addTextFieldWithValue:label: ? Thanks SO much in advance! 回答1: create the text field as a subview of the UIAlertView // Ask for Username and password. alertView = [[UIAlertView alloc] initWithTitle:_title message:@"\n \n \n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil

clickedButtonAtIndex in appdelegate is not called

荒凉一梦 提交于 2019-12-22 08:03:12
问题 I am calling UIAlert with 2 buttons "Cancel" and "OK" in MyapplicationAppDelegate.m file , the alert is called but on tap of "Cancel" or "OK" button -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex method is not called. I have added UIAlertViewDelegate in the MyapplicationAppDelegate.h file as below #import UIKit/UIKit.h @interface MyapplicationAppDelegate: NSObject UIApplicationDelegate,UIAlertViewDelegate { .. } I want to know what else is required. 回答1:

UIAlertView Buttons(subviews) is not Showing in iOS 7

拟墨画扇 提交于 2019-12-22 06:57:05
问题 UIAlertView is working fine in ios 6 with below code .But when it comes to ios 7 the subviews ( "yes" and "no" buttons in my code ) is not showing when alertview is called only text message is showing .Can anyone tell me how to resolve this problem ? viewController.m file [Utilities prCustomAlert:@"Textmessage" inTitle:@"Alert view title" delegate:self inTag:300]; CustomAlertView *alertView = [Utilities sharedUtility].customAlertView; alertView.numberOfBtns = 2; UIButton *btn= (UIButton *)

How can I display a popup message in Swift that disappears after 3 seconds or can be cancelled by user immediatelly?

一曲冷凌霜 提交于 2019-12-22 05:06:13
问题 In my swift app I have a UIViewController with a single button. This button invokes a function that calls a popup that disappears after 3 seconds. Also, after that time it prints a message to the console. The code of this function is as follows: func showAlertMsg(title: String, message: String){ let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert) self.presentViewController(alertController, animated: true, completion: nil) let delay = 3.0 * Double