uialertview

How to add a TextField to UIAlertView in Swift

偶尔善良 提交于 2019-11-29 20:53:36
I have this code, but I dont know how to show a textfield inside the UIAlertView. var altMessage = UIAlertController(title: "Warning", message: "This is Alert Message", preferredStyle: UIAlertControllerStyle.Alert) altMessage.addAction(UIAlertAction(title: "Done", style: UIAlertActionStyle.Default, handler: nil)) self.presentViewController(altMessage, animated: true, completion: nil) I have this code for textfield , how can I show this in UIAlerView var my:UITextField = UITextField(frame: CGRectMake(0, 0, 10, 10)) I also tried this code: var alert = UIAlertView() alert.title = "Enter Input"

Dismiss UIAlertView after 5 Seconds Swift

妖精的绣舞 提交于 2019-11-29 19:46:43
I've created a UIAlertView that contains a UIActivityIndicator. Everything works great, but I'd also like the UIAlertView to disappear after 5 seconds. How can I Dismiss my UIAlertView after 5 seconds? var alert: UIAlertView = UIAlertView(title: "Loading", message: "Please wait...", delegate: nil, cancelButtonTitle: "Cancel"); var loadingIndicator: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRectMake(50, 10, 37, 37)) as UIActivityIndicatorView loadingIndicator.center = self.view.center; loadingIndicator.hidesWhenStopped = true loadingIndicator.activityIndicatorViewStyle =

Create UIActionSheet 'otherButtons' by passing in array, not varlist

半城伤御伤魂 提交于 2019-11-29 19:24:45
I have an array of strings that I want to use for button titles on a UIActionSheet. Unfortunately, the otherButtonTitles: argument in the method invocation takes a variable length list of strings, not an array. So how I can I pass these titles into the UIActionSheet? The workaround I've seen suggested is to pass nil into otherButtonTitles:, then specify the button titles individually by using addButtonWithTitle:. But this has the problem of moving the "Cancel" button to the first position on the UIActionSheet rather than the last; I want it to be the last one. Is there a way to 1) pass an

IOS UIAlertView UIActionSheet

夙愿已清 提交于 2019-11-29 17:38:20
参考资料: http://pro.ctlok.com/2010/08/iphone-ipad-uialertview.html http://www.istar.name/blog/ios-use-uialertview UIAlertView 這個元件並不常用,如果將 UIAlertView 用作顯示普通訊息,這不是一個好的介面設計,因為彈出來的訊息是非常引人注意的,就好像 Javascript 的 alert 一樣,彈出來後整個視窗也不能操作,一定要用戶按下 “OK” 才能繼續操作,我相信各位也不喜歡到經常彈出 alert box 的網站吧,在 iPhone 也是同樣道理。 那何時才使用 UIAlertView ? 應該是有某些訊息無論如何也要用戶去知道,不是那些無關緊要的事,有可能是你的應用程式發生一些問題,令操作不能繼續的訊息。例如你的應用程式必須依賴網路來拿取資料,但用戶的裝置根本沒有連接網路,這時候你便需要使用 UIAlertView 去提示用戶去連接網路,不然應用程式不能運作。 #import <UIKit/UIKit.h> @interface ButtonViewController : UIViewController<UIActionSheetDelegate,UIAlertViewDelegate> @property (weak, nonatomic)

[Swift]UIKit学习之警告框:UIAlertController和UIAlertView

拈花ヽ惹草 提交于 2019-11-29 16:45:07
Important: UIAlertView is deprecated in iOS 8. (Note that UIAlertViewDelegate is also deprecated.) To create and manage alerts in iOS 8 and later, instead use UIAlertController with a preferredStyle ofUIAlertControllerStyleAlert. ‍ ‍ 在Xcode7中使用 UIAlertView会报如下 警告: 'UIAlertView' was deprecated in iOS 9.0: UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead ‍ ‍ Alert Views : Alert views display a concise and informative alert message to the user. UIAlertController 同时替代了 UIAlertView 和 UIActionSheet,从系统层级上统一了 alert 的概念 —— 即以 modal 方式或

'wait_fences: failed to receive reply: 10004003' on loading UIAlertView (iOS)

喜夏-厌秋 提交于 2019-11-29 15:37:47
问题 I'm getting the 'wait_fences: failed to receive reply: 10004003' when I call a UIAlertView. It's called when the app first opens. It doesn't crash the app or seem to effect the functionality of it at all but I want to clean up my app completely. It's a tab bar app and I've entered the code in the viewDidLoad section of the View Controller that's first loading in the app: - (void)viewDidLoad { [super viewDidLoad]; UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Welcome!" message:@

Push Notifications without alert

江枫思渺然 提交于 2019-11-29 15:18:12
问题 Can I get push notifications without alert view? The idea in what service for game will send notifications as response for change game state (may be game state will store in database), if this is impossible, what you can suggest about how me send new game state to each connected game client as response of changing game state. Game will be developing for iPad. Thanks, Roman 回答1: No, a push notification will always display a notification as it requires user consent to wake up or launch your

UIAlertView in iOS8 appearing off-center, mis-placed, only portion of the screen dimmed

人走茶凉 提交于 2019-11-29 14:55:38
I'm building an iPad app on iOS8, landscape, upgrading from iOS7. I've replaced UIAlertView (deprecated) with UIAlertController in a number of other places in my app which has fixed this issue. However, I also use a UIWebView which apparently shows its own UIAlertViews. When this happens I also get the same problem (see partial pic, cropped). The alert view is misplaced lower to the left and only the left 2/3 of the screen is dimmed, and worse, the right most portion that is not dimmed still responds to touch gestures, so it's possible to control the app behind the modal! The alert that the

iOS4 (UIAlertView) why this code causes memory leaks?

若如初见. 提交于 2019-11-29 12:35:44
suppose you create a new iOS app from scratch, with just one single window. then you put this code in the appDelegate application didFinishLaunching method : UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"alert" message:@"message" delegate:nil /* same problem with 'delegate:self' */ cancelButtonTitle:nil otherButtonTitles:@"Ok", nil]; [myAlert show]; [myAlert release]; build and run in simulator 4.1, attach instrument, and... this causes each time a memory leak. in simulator 3.1.2 on leopard, no problem at all. Of course, in a real app, the UIalertView is trigerred by a button,

how to add a UITableView into UIAlertView in iOS 7

纵饮孤独 提交于 2019-11-29 12:02:02
did some googling around saw that subview is no longer supported in iOS 7. Some ppl recommend creating custom view, but i am not sure how can i do that. Here is my code, can anyone point me in the correct direction? -(IBAction)click_select_fruit_type { select_dialog = [[[UIAlertView alloc] init] retain]; [select_dialog setDelegate:self]; [select_dialog setTitle:@"Fruit Type"]; [select_dialog setMessage:@"\n\n\n\n"]; [select_dialog addButtonWithTitle:@"Cancel"]; idType_table = [[UITableView alloc]initWithFrame:CGRectMake(20, 45, 245, 90)]; idType_table.delegate = self; idType_table.dataSource =