Tag: uialertview

如何在iOS中更改UIAlertView对话框的颜色?

我有一个应用程序,我使用UIAlertView显示一条警报消息。 默认情况下,对话框的颜色是蓝色的。 谁能告诉我,如何改变颜色? 可以改变吗?

显示UIAlertView时不能使用控制中心(iOS 7)

所以当可达性检测到没有连接时,我build立了一个重试连接。 我希望用户能够在显示UIAlertView的同时使用控制中心重新启用WiFi。 无论如何,我可以做到这一点? 什么控制中心看起来像 UIAlertView的图片

UIAlertView与用户提供的上下文和

我已经查看了一些关于如何向UIAlertView提供上下文的想法。 常见的答案是保存在字典或UIAlertView的子类。 我不喜欢在字典中保存上下文的想法,这是数据的错误地方。 UIAlertView的子类化不被Apple支持,所以按照我的标准,这不是一个好的解决scheme。 我提出了一个想法,但我不知道该怎么做。 创build一个作为UIAlertView的委托的上下文对象的实例。 警报视图上下文又有它自己的代表,它是视图控制器。 麻烦是释放记忆。 我将alertView.delegate设置为nil,并调用[self autorelease]以释放-alertView:didDismissWithButtonIndex中的上下文对象。 问题是 :我自己造成什么问题? 我有一个怀疑,我正在设置一个微妙的记忆错误。 这里是仅支持-alertView的简单版本:clickedButtonAtIndex: 使用 – (void)askUserIfTheyWantToSeeRemoteNotification:(NSDictionary *)userInfo { [[[[UIAlertView alloc] initWithTitle:[userInfo valueForKey:@"action"] message:[userInfo valueForKeyPath:@"aps.alert"] delegate:[[WantAlertViewContext alloc] initWithDelegate:self context:userInfo] cancelButtonTitle:@"Dismiss" otherButtonTitles:@"View", nil] autorelease] show]; } – (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex withContext:(id)context { if (buttonIndex != alertView.cancelButtonIndex) [self presentViewForRemoteNotification:context]; } 接口 @protocol WantAlertViewContextDelegate <NSObject> – (void)alertView:(UIAlertView *)alertView […]

Iphone presentLocalNotificationNow不触发警报和声音,而应用程序在后台

我有一个应用程序注册的位置更新,运行testing,当我进入一个地区,而应用程序在后台我收到警报通知声音的某个时候。 有时我只能在通知中心看到通知,而且我没有收到任何声音和警报。您可以做些什么来始终获得声音和警报通知? 这是我的观点 UILocalNotification *localNotif = [[UILocalNotification alloc] init]; localNotif.fireDate = nil; localNotif.hasAction = YES; localNotif.alertBody = fbName; localNotif.alertAction = @"View"; localNotif.soundName = UILocalNotificationDefaultSoundName; [[UIApplication sharedApplication]presentLocalNotificationNow:localNotif]; 这是应用程序的代表 – (void)application:(UIApplication *)application didReceiveLocalNotification (UILocalNotification *)notification { if (notification) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Alert" message:notification.alertBody delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } } – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary […]

行动:@select器(showAlert :)如何传递参数在这个showAlert方法?

我将自定义button添加到我的UITableViewCell 。 在该button的操作中,我想调用showAlert:函数,并希望在方法中传递单元格标签。 如何传递showAlert方法中的参数: action:@selector(showAlert:) ?

如何在Swift中旋转UIAlertController

我有一个工作的UIAlertController ,但我想要alert.view 90度的alert.view 。 我该怎么做? 我的代码如下: let alert = UIAlertController(title: "", message: "Message Sample", preferredStyle: .Alert) alert.addAction(UIAlertAction(title: "Okay", style: .Default){(action)->() in }) presentViewController(alert, animated: true) {} 我试图添加: alert.view.transform = CGAffineTransformMakeRotation(CGFloat(M_PI_2)) 但它不起作用。 谢谢 !

tony million可达性说连接时无法连接

我已经search,但没有发现像我的问题。 我确定这是我看过的东西。 我正在使用tony百万的可达性块的方法。 当我有互联网,然后没有互联网,这是工作良好。 警报出现,工作得很好。 但是,当我没有互联网,然后我得到互联网相同的警报popup 我的代码是 -(void)reachabilityBlock { // allocate a reachability object Reachability * reach = [Reachability reachabilityWithHostname:@"www.google.com"]; // tell the reachability that we DONT want to be reachable on 3G/EDGE/CDMA reach.reachableOnWWAN = YES; reach.reachableBlock = ^(Reachability * reachability) { dispatch_async(dispatch_get_main_queue(), ^{ //NSLog(@"REACHABLE! block"); [self newsTableViewRefresher]; }); }; reach.unreachableBlock = ^(Reachability * reachability) […]

尝试在写入事务之外修改对象

所以我不知道为什么我得到这个错误。 错误消息如下所示: *由于未捕获的exception“RLMException”而终止应用程序,原因是:“尝试修改写事务之外的对象 – 首先在RLMRealm实例上调用beginWriteTransaction。 *第一次调用堆栈:(0x2f7b0f83 0x39f61ccf 0xc46ef 0xc3c23 0xc0c9d 0xb3e73 0x3a449833 0x3a449ded 0x3a44a297 0x3a45c88d 0x3a45cb21 0x3a58bbd3 0x3a58ba98)libc ++ abi.dylib:以NSExceptiontypes的未捕获exception 执行此代码时被抛出。 – (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { UITextField * alertTextField = [alertView textFieldAtIndex:0]; if (![self.chatSession.theirAlias isEqualToString:alertTextField.text]) { self.sender = alertTextField.text; dispatch_queue_t queue = ((AppDelegate *)[UIApplication sharedApplication].delegate).queueForWrites; dispatch_async(queue, ^{ [[RLMRealm defaultRealm] beginWriteTransaction]; self.chatSession.myAlias = alertTextField.text; // This […]

在UIAlertView中更改取消button的位置?

我注意到,当我从我的iPhone主屏幕上删除一个应用程序,出现的警报视图显示在左边的删除button和在右边的取消。 但是,当我使用UIAlertView在我的应用程序中构build一个删除function时,这些button似乎只显示左边的取消和右边的删除。 我想我的应用程序与操作系统一致,但我不知道如何使取消button首先出现。 有人知道吗? UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Delete Song" message:@"Are you sure you want to delete this song? This will permanently remove it from your database." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Delete", nil]; 我尝试设置alert.cancelButtonIndex = 1,但是没有效果。

显示手机数据已closures警报

我怎样才能显示这个警报视图? 我知道我需要检查连接与可达性,但如何显示此设置和确定button的警报? 我需要它的iOS 6。