uialertview

Problems with getting text from UIAlertView textfield

…衆ロ難τιáo~ 提交于 2019-11-29 00:16:37
In my application I want a alert with a textfield. After clicking on "Done" I want to save the textfield input in a String. After clicking on "Cancel" I want only to close the alert. I've created my alert like this: var alert = UIAlertView() alert.title = "Enter Input" alert.addButtonWithTitle("Done") alert.alertViewStyle = UIAlertViewStyle.PlainTextInput alert.addButtonWithTitle("Cancel") alert.show() let textField = alert.textFieldAtIndex(0) textField!.placeholder = "Enter an Item" println(textField!.text) The alert looks like this: I want to know how to get the text from the textfield, and

Showing an alert in an iPhone top-level exception handler

与世无争的帅哥 提交于 2019-11-28 23:49:21
I'm trying to display a UIAlertView in a top-level iPhone exception handler. The handler function looks like this: void applicationExceptionHandler(NSException *ex) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[ex reason] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } I've seen similar code elsewhere (for instance, NSSetUncaughtExceptionHandler not catch all errors on iPhone ). If I single-step in the debugger, I can see that the exception handler is called, and I can see the current screen dim as if it's going to display the

Xamarin iOS教程之警告视图

拟墨画扇 提交于 2019-11-28 23:23:03
Xamarin iOS教程之警告视图 Xamarin iOS 警告视图 如果需要向用户显示一条非常重要的消息时,警告视图( UIAlertView 类)就可以派上用场了。它的功能是把需要注意的信息显示给用户。一般显示一条信息,或者是显示一条信息和几个按钮。本节将主要讲解如何为主视图添加警告视图,如何将警告视图进行显示、如何以不同的形式显示警告视图以及响应警告视图。 Xamarin iOS 为主视图添加警告视图 在工具栏中是没有警告视图的,开发者必须使用代码的形式在主视图中进行添加。它的添加和其他视图的添加是有区别的。具体步骤如下: 1. 实例化对象 UIAlertView 类提供的警告视图,所以在使用前,必须要进行实例化。其语法形式如下: UIAlertView 对象名 =new UIAlertView(); 2. 显示 在实例化对象以后,就是此警告视图对象进行显示。此时不需要使用 AddSubview() 方法,而需要使用 Show() 方法,其语法形式如下: 对象名 .Show(); 【示例 2-27 】以下将实现在主视图中显示一个警告视图的功能。代码如下: using System; using System.Drawing; using MonoTouch.Foundation; using MonoTouch.UIKit; namespace Application {

How to create an alert box in iphone?

落花浮王杯 提交于 2019-11-28 18:56:24
问题 I would like to make an alert type box so that when the user tries to delete something, it says, "are you sure" and then has a yes or no for if they are sure. What would be the best way to do this in iphone? 回答1: A UIAlertView is the best way to do that. It will animate into the middle of the screen, dim the background, and force the user to address it, before returning to the normal functions of your app. You can create a UIAlertView like this: UIAlertView *alert = [[UIAlertView alloc]

Simple App Delegate method to show an UIAlertController (in Swift)

为君一笑 提交于 2019-11-28 18:35:32
In obj-C when another iOS app (mail attachment, web link) was tapped with a file or link associated with my app. I would then catch this on openURL or didFinishLaunchingWithOptions and show a UIAlertView to confirm the user wants to import the data. Now that UIAlertView is depreciated I am trying to do the same thing but not really sure about the best way to do this? I am having trouble showing a simple alert when my App receives data from another app. This code worked fine in Objective-C with a UIAlertView : - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url

EXC_BAD_ACCESS code 2 on UIAlertView in iOS6

半城伤御伤魂 提交于 2019-11-28 18:09:42
I'm trying to figure out why im getting this crash in my app. It works perfectly fine in Xcode 4.4 running in the simulator with ios5.1, but when i switch into xcode 4.5 and ios6 I'm getting an EXC_BAD_ACCESS code 2. Here is my code: - (void) myMethod { UIAlertView *alertview = [[[UIAlertView alloc]initWithTitle:@"Title" message:@"message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil] autorelease]; alertview.tag = 1 [alertview show]; } this is giving me an EXC_BAD_ACCESS code 2 on the [UIAlertView show] line any ideas? thanks! I've got it. I have the same problem, in my case it

UIView Popup like UIAlertView

只谈情不闲聊 提交于 2019-11-28 18:03:07
I Want a UIView which can popup like UIAlertView and also can move. Any help please?? Thank you. Animate the view's transform using UIView animation ( using blocks or older api ) from some really small size (like view.transform = CGAffineTransformMakeScale(0.1, 0.1) ) to something a little bigger then you want it to be (like view.transform = CGAffineTransformMakeScale(1.1, 1.1)) , then back to the desired size (view.transform = CGAffineTransformMakeScale(0.1, 0.1)) , or add more steps for bigger bounce. And for moving it around, implement the touch methods and change the view's frame as the

Several UIAlertViews for a delegate

做~自己de王妃 提交于 2019-11-28 17:47:59
Currently I've got a class popping up UIAlertView s here and there. Currently, the same class is the delegate for these (it's very logical that it would be). Unfortunately, these UIAlertView s will call the same delegate methods of the class. Now, the question is - how do you know from which alert view a delegate method is invoked? I was thinking of just checking the title of the alert view, but that isn't so elegant. What's the most elegant way to handle several UIAlertView s? Tag the UIAlertView s like this: #define kAlertViewOne 1 #define kAlertViewTwo 2 UIAlertView *alertView1 = [

iOS dismiss UIAlertView beforing showing another

冷暖自知 提交于 2019-11-28 17:17:09
I have a Utils class which shows UIAlertView when certain notifications are triggered. Is there a way to dismiss any open UIAlertViews before showing a new one? Currenty I am doing this when the app enters the background using [self checkViews:application.windows]; on applicationDidEnterBackground - (void)checkViews:(NSArray *)subviews { Class AVClass = [UIAlertView class]; Class ASClass = [UIActionSheet class]; for (UIView * subview in subviews){ if ([subview isKindOfClass:AVClass]){ [(UIAlertView *)subview dismissWithClickedButtonIndex:[(UIAlertView *)subview cancelButtonIndex] animated:NO];

Customize UIAlertController in iOS 8 to include standard elements like UITableView

馋奶兔 提交于 2019-11-28 17:14:28
问题 I am used to customize UIAlertViews through the [ alert setValue:someView forKey:@"accessoryView"] method. This creates customizable content for UIAlertViews with custom heights. However it only works on iOS7 and down. In iOS8 the UIAlertController have taken over, and I cannot customize it anymore, it will cut the height of the UIAlertView . Is it impossible because of misuse of the UIAlertController , or how am I supposed to do it? I am trying to incorporate a UITableView inside a