草庐IT

alertViews

全部标签

ios - 创建 alertview 并点击标签

我正在尝试创建自定义警报View类,但在为点击的View创建完成block时遇到问题我想要的是这样的,+(void)alertview:(UIViewController*)vchandler:(void(^)(UITapGestureRecognizer*))callback{UILabel*lbl1=[[UILabelalloc]init];lbl1.text=@"A";UILabel*lbl2=[[UILabelalloc]init];lbl1.text=@"B";UILabel*lbl3=[[UILabelalloc]init];lbl1.text=@"C";}并且当用户触摸时

iphone - 多个 alertViews 创建错误

你好,下午好,我遇到了一些问题,老实说,我不明白我必须为具有不同消息的同一屏幕创建不同的alertViews,这些警报中的大多数只有1个按钮,但是有一个要删除需要2个按钮,问题是,因为其他人只有1个按钮,当我创建2按钮屏幕View,我添加了(void)alertView:(UIAlertView*)alertViewclickedButtonAtIndex:(NSInteger)buttonIndex方法,我遇到了一些问题一些代码在这里-(IBAction)saveInfo{if(med.text.length==0){UIAlertView*alertViewError=[[UIAl

ios - 访问 alertView 的调用 View

我有一个UIAlertView,它在用户想要删除RegionAnnotation时显示为确认。我无法弄清楚如何访问调用UIAlertView的RegionAnnotationView,我需要它来删除RegionAnnotation。这是我损坏的代码-您可以看到我试图将AlertView的superView转换为RegionAnnotationView的地方(公认的坏主意)。-(void)alertView:(UIAlertView*)alertViewclickedButtonAtIndex:(NSInteger)buttonIndex{if(buttonIndex==0){NSLog

iOS 8.1 CoreLocationManager requestWhenInUseAuthorization 不提示 AlertView

我正在尝试在我的iOS应用程序上使用用户位置。该应用程序适用于iOS7,但不适用于iOS8。我都试过了。看了一堆教程,我知道在iOS8中我们需要调用requestWhenInUseAuthorization方法并将NSLocationWhenInUseUsageDescription键添加到Info.plist中。但它仍然无法正常工作,它没有征求用户的许可,我正在真实设备(运行iOS8.1.x的iPhone5c)中进行测试。我多次尝试重新安装该应用程序。这些是我为测试这个东西而创建的一个非常非常小的项目的代码。我的ViewController.m#import"ViewControll

iphone - AlertView 正在运行但未显示 didReceiveRemoteNotification

使用调试器我已确保正在调用[alertViewshow];,但对话框不可见,我还需要做什么才能显示它?-(void)application:(UIApplication*)applicationdidReceiveRemoteNotification:(NSDictionary*)userInfo{if([[userInfoobjectForKey:@"aps"]objectForKey:@"alert"]!=NULL){NSString*msg=[[userInfoobjectForKey:@"aps"]objectForKey:@"alert"];if(msg!=nil){UIAl

ios - AlertView 不在 ios7 中旋转?

我们的应用只支持横屏模式,需要支持iOS5.1&6.0&7.0。到目前为止,我们已经设置了rootviewcontroller和BaseSdk:7.0部署目标:5.1我们的应用程序在iOS5和ios6中运行良好。但是在iOS7中,当alertview存在并且用户旋转到纵向时,alertview也会旋转到纵向,这在iOS5和6上不会发生。而且一旦alertview变为纵向,它就不会旋转到横向。注意:我的ViewController的方向很好。它始终只支持横向。 最佳答案 我通过实现supportedInterfaceOrientati

iphone - iOS-如何在代码开始前显示 alertView

我有以下代码:-(IBAction)showAlertView:(id)sender{alertView=[[UIAlertViewalloc]initWithTitle:@"Atualizando"message:@"\n"delegate:selfcancelButtonTitle:nilotherButtonTitles:nil];spinner=[[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];spinner.center=C

ios - 尝试在 iOS 中使用 if/else 语句显示 alertView

我正在编写一个应用程序,我希望在其中显示一个alertView,该alertView会根据是否发生某些情况显示不同的消息。如果所有情况都不匹配,则不应显示任何警报,并且应处理应用程序的其余部分。我的问题是我不确定该怎么做。我有以下代码:-(void)methodThatIsCalled{NSString*msg;if(blah){msg=@"MessageA";}elseif(blahblah){msg=@"MessageB";}elseif(blahblahblah){msg=@"MessageC";}//HereiswhereIwanttodisplaytheAlertcodeUI

按钮上的 iOS alertview 操作

我在菜单中有一个按钮,触摸该按钮时会弹出带有两个按钮的警告消息:“Cancel”和“Yes”。这是我的警报代码:UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:@"Exitgame"message:@"Areyousure?"delegate:nilcancelButtonTitle:@"Cancel"otherButtonTitles:@"Yes",nil];[alertshow];是否可以向按钮“Yes”添加一个Action? 最佳答案 在您的代码中设置UIAlertView

ios - 通过 View Controller 中的 alertview 按钮显示按钮

我有一个警报View,它会在每次启动应用程序时出现。当我单击取消按钮时单击警报View的显示按钮时,我想在ViewController上显示一个按钮,然后此按钮将不会显示。我正在使用此代码来执行此操作。-(void)alertView:(UIAlertView*)alertViewclickedButtonAtIndex:(NSInteger)buttonIndex{if(buttonIndex==0){ViewController*controller=[[ViewControlleralloc]init];controller.button.hidden=NO;}在vi​​ewco