uialertview

Several UIAlertViews for a delegate

别来无恙 提交于 2019-11-27 10:45:10
问题 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? 回答1: Tag the

Dismissing UIAlertViews when entering background state

倾然丶 夕夏残阳落幕 提交于 2019-11-27 10:30:24
Apple recommends dismissing any UIAlertViews/UIActionSheets when entering background state in iOS 4. This is to avoid any confusion on the user's part when he relaunches the application later. I wonder how I could elegantly dismiss all UIAlertViews at once, without retaining a reference to it everytime I set one up... Any idea ? Guillaume I was intrigued by Dad's answer (funny username :), and curious why it was down-voted. So I tried it. Here is the .m part of a subclass of UIAlertView. Edit: (Cédric) I have added a way to catch calls to delegate methods and remove the observer then to avoid

How to add an action to a UIAlertView button using Swift iOS

谁说我不能喝 提交于 2019-11-27 10:19:23
问题 I want to add another button other than the "OK" button which should just dismiss the alert. I want the other button to call a certain function. var logInErrorAlert: UIAlertView = UIAlertView() logInErrorAlert.title = "Ooops" logInErrorAlert.message = "Unable to log in." logInErrorAlert.addButtonWithTitle("Ok") How do I add another button to this alert, and then allow it to call a function once clicks so lets say we want the new button to call: retry() 回答1: The Swifty way is to use the new

iOS UIAlertView button to go to Setting App

无人久伴 提交于 2019-11-27 10:18:00
Is there a way to have the button of a UIAlertView go to the Settings App for the specific App calling it? Thanks For example: NSURL*url=[NSURL URLWithString:@"prefs:root=WIFI"]; [[UIApplication sharedApplication] openURL:url]; And [font=] About — prefs:root=General&path=About Accessibility — prefs:root=General&path=ACCESSIBILITY Airplane Mode On — prefs:root=AIRPLANE_MODE Auto-Lock — prefs:root=General&path=AUTOLOCK Brightness — prefs:root=Brightness Bluetooth — prefs:root=General&path=Bluetooth Date & Time — prefs:root=General&path=DATE_AND_TIME FaceTime — prefs:root=FACETIME General — prefs

iOS - Push notification alert is not shown when the app is running

荒凉一梦 提交于 2019-11-27 09:26:07
问题 I've integrated push notifications in my app. Users will receive push notification to join a group. When the user clicks Join , I've to handle something in the code. And so I'm implementing: - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo This is working fine when the app is not running. When the app is running, I don't see any UIAlertView . How can make my app show the push notification alert so that user can still decide whether to join

Get the top ViewController in iOS Swift

99封情书 提交于 2019-11-27 09:18:29
I want to implement a separate ErrorHandler class, which displays error messages on certain events. The behavior of this class should be called from different other classes. When an error occurs, it will have an UIAlertView as output. The display of this AlertView should ALWAYS be on top. So no matter from where the Error gets thrown, the topmost viewController should display the AlertMessage (e.g. when an asynchronous background process fails, I want an error message, no matter what View is displayed in the foreground). I have found several gists which seem to solve my problem (see the code

wait_fences: failed to receive reply: 10004003 error - UIAlert WITHOUT UITextField present

风格不统一 提交于 2019-11-27 08:45:41
I am working on an app where a UIAlert pops up the first time the user begins using it to ask if they want to use their current location. This happens within the main controller. However, I get the following error when using the UIAlert: wait_fences: failed to receive reply: 10004003 I debugged it, and googled around. I am not using a textarea or keyboard input, so I don't have to resign a first responder. However, I still cannot figure out why I would be getting this error. It only appears when I add the UIAlert. MainController.m - (void)viewDidLoad { UIAlertView *mainAlert = [[UIAlertView

UIAlertView crashes when added to app

删除回忆录丶 提交于 2019-11-27 08:30:54
问题 I am trying to impliment a basic UIAlertView into my app (I am using storyboard). But when I run my app, it goes to the debugger screen after stalling at the app's loading screen. my .h: #import <UIKit/UIKit.h> @interface MindTripAnim :UIViewController { IBOutlet UIImageView *animation; } - (IBAction)showMessage:(id)sender; @end and my .m: #import "MindTripAnim.h" @interface MindTripAnim () @end @implementation MindTripAnim - (void)viewDidLoad { animation.animationImages = [NSArray

iOS 7 UIDatePicker in UIAlertView customisation

你。 提交于 2019-11-27 08:12:50
问题 Guys I was adding UIDatePicker to UIAlertView like this It was fine with iOS 6 and below now in iOS 7 it comes like this Any ideas why this happens? Is there a better way of doing this?.Any help is appreciated. 回答1: This is my component to support addSubview in AlertView. CXAlertView - Custom alert-view which allow you to add view as main content. 回答2: You can change accessoryView to any own customContentView in a standard alert view in iOS7 [alertView setValue:customContentView forKey:@

iOS 7 bug or my bug in UIAlertView

我与影子孤独终老i 提交于 2019-11-27 07:48:39
I have got the following stack trace while my app crashes on tapping "OK" on a UIAlertView. Is it my fault or a iOS7 bug? I don't know how to fix this. OS Version: iOS 7.0 (11A465) Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000 Triggered by Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libobjc.A.dylib 0x39d50b36 objc_msgSend + 22 1 UIKit 0x3212e3da -[UIAlertView(Private) modalItem:shouldDismissForButtonAtIndex:] + 58 2 UIKit 0x31ed2036 -[_UIModalItemsCoordinator _notifyDelegateModalItem