Tag: uialertview

另一个视图控制器上的UIAlertView崩溃问题

我有2个视图控制器, ViewController 1(VC1)和2(VC2)。 在VC2中,我有一个后退和完成button。 在点击返回button时,它直接进入VC1,在完成后进行一次api调用,当它得到一个响应时,它显示一个警报视图,点击OK返回到VC1。 现在,当我进行api调用时,出现一个加载条,并在获取响应并显示AlertView时消失。 但是,如果在加载消失的第二秒的时间内,如果我点击返回并且视图改变为VC1, AlertView将popup,则VC1上将出现警报,并导致崩溃。 这是一个罕见的情况,因为没有用户会故意尝试,但我想知道是否可以在不禁用后退button的情况下pipe理崩溃。 我认为可能有其他实例这样的情况下,如果我们正在进行asynchronous调用,并且如果允许用户在等待响应时使用UI,并且如果任何错误警报假设显示在一个ViewController显示在另一个可能会导致因为警报所指的代表是前一个视图控制器的崩溃。 那么有没有办法有效地处理这种崩溃? //Alert View sample UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[[message objectAtIndex:1] capitalizedString] message:[message objectAtIndex:0] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] ; [alert setTag:701]; [alert show]; – (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if ([alertView tag] == 701) if (buttonIndex == 0) { [self.navigationController popViewControllerAnimated:YES]; } }

UIAlertViewStyleLoginAndPasswordInput与更多的TextFields?

它可能添加更多的TextFields到UIAlertViewStyleLoginAndPasswordInput? 我怎么办? 或者还有其他的可能性?

UIAlertView IndexButton

我在这里有这个代码在我的地图注释… //alert view if ([ann.title isEqual: @"Al-saidiya"]) { NSString *msg=@"Phone No : 079011111"; UIAlertView *alert1 = [[UIAlertView alloc]initWithTitle:@"Contact" message:msg delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"Call Us", nil]; [alert1 show]; } else if ([ann.title isEqual: @"Al-Kadmiya"]) { NSString *msg=@"Phone No : 07902222222"; UIAlertView *alert2 = [[UIAlertView alloc]initWithTitle:@"Contact" message:msg delegate:self cancelButtonTitle:@"ok" otherButtonTitles:@"Call Us", nil]; [alert2 show]; } else if ([ann.title […]

3次后打开应用程序显示uialertview?

让我们说3次后打开一个应用程序是否有可能显示Alertview? 这可以用NSUserDefaults来完成吗? 谢谢!

在UIAlertView的自动dimissal之后,导航栏的色彩更改

我写了我的自定义UIAlertview允许在某些情况下自动解雇。 现在,在iOS 7的自动解雇发生我的导航栏的色彩变化。 根据iOS7转换指南: https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/TransitionGuide.pdf 当出现警告或操作表时,iOS 7会自动调暗其后的视图的色调。 为了响应这种颜色变化,在其渲染中使用tintColor的自定义视图子类应该覆盖tintColorDidChange以适当刷新渲染。 任何想法,如果这只能在自定义的UIAlertView中处理。 以下是我自定义UIAlertView的代码: #define kStartupFailAlert 203 #import "RunnerUIAlertView.h" @implementation RunnerUIAlertView – (id)init { self = [super init]; if (self) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeAlert) name:kRemoveVisibleAlert object:nil]; } return self; } – (void)removeAlert { if (self.tag != kStartupFailAlert) { // If not kRunnerStartupFailAlert – as it will be auto […]

如果UITextField不为空,请现场检查

我有一个包含UITextField的UIAlertView。 警报视图有两个button。 一个正常的“解雇”button和另一个“添加”。 如果UITextField不为空,“添加”button应该是可点击的。 如果字段是空的,我不知道如何检查“实时”。 我只看到如果button被点击,检查textField的可能性。 但是,这不是什么想(如果theField是空的,“添加”button应该变灰)。 你有这个解决scheme吗? 谢谢你的努力! 我正在使用Swift 3和Xcode 8

在打开phone.app之前显示UIAlertView

我有一个button和button上的标签在地图上的看法。 在标签上我有一个来自plist的电话号码。 plist中的电话号码variables叫做“storePhone”,我用这种方式实现它: text4.text = myAnn.storePhone; 我做了这个方法按下button,并打开phone.app拨号。 一切都很好,但我想要一个UIViewAlert对用户说:“你要拨这个号码,你确定吗? 在phone.app打开之前。 我怎样才能做到这一点? 这是我的button方法: -(IBAction)callToStore { NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", text4.text]]; [[UIApplication sharedApplication] openURL:url]; } 谢谢。

UIAlertView只有在被解散后才显示出来

我一直想弄明白这个问题2天了,在任何人发布另一个stackoverflow问题之前,我已经阅读了他们,没有一个完全覆盖我的问题: 我有一个dynamic更新的CoreData应用程序。 现在在更新期间,我想要一个UIAlertViewpopup说正在下载更新。 所以这里是重要的代码: AppDelegate: – (void)applicationDidBecomeActive:(UIApplication *)application { [myUpdater checkForUpdatesInContext:self.managedObjectContext]; } _ Updater Class: – (void)checkForUpdatesInContext:(NSManagedObjectContext *)myManagedObjectContext { [self loadUpdateTime]; NSLog(@"Update start"); NSDate *now = [NSDate dateWithTimeIntervalSinceNow:[[NSTimeZone localTimeZone] secondsFromGMT]]; if ([now timeIntervalSinceDate:updateTime] < UPDATE_TIME_INTERVAL) { return; } [self showAlertViewWithTitle:@"Update"]; … //updating process [self.alertView dismissWithClickedButtonIndex:0 animated:YES]; NSLog (@"Update done"); } – (void) showAlertViewWithTitle:(NSString *)title { […]

在UIAlertView中向下移动button

我有一个横向模式显示的应用程序,我用下面的代码覆盖了UIAlertView的高度: – (void) willPresentAlertView:(UIAlertView *)alertView { CGRect screenBounds = [[UIScreen mainScreen] bounds]; CGRect frame = [alertView frame]; alertView.frame = CGRectMake(frame.origin.x, 0, frame.size.width, screenBounds.size.width); } 这几乎工作。 UIAlertView更高,但是,alertview中的button不会被推下。 有没有人知道我怎么可以在UIAlertView按下button,当我改变警报视图的高度?

UIAlertView需要时间来显示

我想显示按下button的警报视图。 显示它,但在屏幕上显示需要太多时间。 这里是我按下button的function: -(void)saveAndClose:(id)sender { waitForOCR=[[UIAlertView alloc] initWithTitle:@"Processing…" message:@"Please wait." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil, nil]; waitForOCR.delegate=self; [waitForOCR show]; if(!isCancelled){ NSMutableArray *dateSaved=[[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] arrayForKey:@"dateCaptured"]]; NSDateFormatter *dateText=[[NSDateFormatter alloc] init]; [dateText setDateFormat:@"yyyy-MM-dd"]; NSDate *now=[NSDate date]; NSString *dateValue=[dateText stringFromDate:now]; [dateSaved addObject:dateValue]; NSMutableArray *timeSaved=[[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] arrayForKey:@"timeCaptured"]]; NSDateFormatter *timeText=[[NSDateFormatter alloc] init]; [timeText setDateFormat:@"HH:mm:ss"]; NSString *timeValue=[timeText stringFromDate:now]; [timeSaved addObject:timeValue]; […]