I've decided to make a class that emulates the functionality of UIAlertView so that I can have a better API for callbacks and theme the alerts better. I add another window to the iOS main window to show the alert.
The problem is with voiceover. With the standard UIAlertView voiceover makes a special sound to indicate that there is an alert view on the screen.
I can get the standard voiceover screen change chirp by posting UIAccessibilityScreenChangedNotification but this is different from the Alert view's chirp.
I want this to feel like a UIAlertView for voiceover users. To do this i need to be able to programatically replicate its special chirp.
It's not ideal (you'd lose the theming for instance), but you could have your custom implementation detect if voiceover is enabled using UIAccessibilityIsVoiceOverRunning() and fall back to using a standard UIAlertView if it is.
Related
I want to have some information drop down from the top of a view, stay on the screen for a second or two, and then go back up out of the view. I have search for displaying notifications and/or banners. All I get is either push notifications (which I don't need to use) or iAds banners.
I'm working on a barcode scanning app and I want to briefly show the value of the barcode shown without requiring the user to tap on anything. How can I accomplish this?
Don't use notifications and banners, because that might not work: the user can turn them off. In any case this is not a notification of anything, so it's a misuse of notifications.
Just do what you described, yourself: animate a view onto the screen, and then (in the animation's completion handler) use delayed performance to animate the view right back off the screen after a short delay.
You should use a view which manages its own state (INCOMING, STAY PUT, OUTGOING). This way you can reduce the memory footprint and many other bugs in the process. I coded something for a similar process. Check it out
In my app, I display a UIAlertController when the user taps on a button on the screen. I either use a UIAlertController or a UIAlertView, depending on the API availability (since my app supports both iOS 7 and 8).
I simply want to display an alert view to the user so I'm using the .Alert style for my UIAlertController.
When the user is on an iPad, is it safe to display the UIAlertController (Alert style) without configuring a popover?
I saw some tutorials online. From my understanding, if using a UIAlertController (Action Sheet style), I need to configure a popover or else the app will crash. I just want to know if it works the same way with an Alert style UIAlertController.
I did some test on my iPad and the app did not crash without the popover. But I want to make sure this is safe.
You never use a UIPopoverController with UIAlertView or UIAlertController (no matter its style).
iOS will internally use a popover on an iPad when the UIAlertController style is "action sheet" but you don't deal with that yourself.
So you have nothing to worry about. Use UIPopoverController as-is using the presentViewController:animated:completed: method no matter the device and you are fine.
I'm using PayPal MPL iOS lib. When ever I press the cancel button an alert message is displayed. How do I prevent UiAlert from coming up?
It appears as if the Paypal library itself is putting the alertview up. So unless there is something in the paypal library to disable that feature then you probably can't directly disable it. There might be a couple of workarounds, here are my thoughts:
Listen to the notifications when a new UIWindow is displayed via NSNotification center. The notifications are listed at the bottom of the document.
https://developer.apple.com/library/ios/documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html
Heres another post that deals with listening to the notification.
Is there a notification on iOS if a UIAlertView is shown?
My thought is maybe you can catch when the alertview is being shown the you can undo it by calling makeKeyAndVisible on your AppDelegates window object
[[UIApplication sharedApplication].delegate.window makeKeyAndVisible];
The other thought that to me seems like a total hack so I'm not going to advocate for or justify is to use method swizzling. If you swizzled the [show] function of UIAlertView then you could inject a simple if statement to decide wether or not to call the real show method effectively deciding wether or not the alert is really shown or not. There may be unforeseen consequences going this route. If your not familiar with the technique NSHipster has a writeup http://nshipster.com/method-swizzling/. Before going this route I would consider how necessary disabling the alert really is.
I'm developing an iOS app that I'd like to make fully accessible. Part of the app involves a sequence when playing cards are dealt, and then after user interaction, the hand ends and the next hand is dealt. When the hand has been dealt, I want to make impaired users aware.
So, after the hand is dealt (a sighted user sees the cards animate into place), I send a UIAccessibilityLayoutChangedNotification notification like so:
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
When I verify in the Simulator using the Accessibility Inspector, everything looks fine: the notification is displayed. But, when I try to test using VoiceOver on a device, nothing seems to be happening. Is there something I'm missing here? How do I know that it works?
I believe that my thinking of how Voiceover works was a bit off. It seems like the UIAccessibilityLayoutChangedNotification isn't something to notify the user, it's to notify UIKit that voiceover elements have changed.
I wound up using a combination of sound effects and strategic use of the UIAccessibilityAnnouncementNotification notification to speak updates to the user.
Instead of using nil use a string. VoiceOver will use that string for speech.
I'm making a game where a player reacts to sounds via motion - seeing as the visual element isn't needed to play it, and many play with their eyes closed, it seems a shame to not be fully VoiceOver compatible. I'm currently using Cocos2D-iPhone and CocosDenshion for audio, and am now starting to think about how I'll be building my menu system to choose levels and configure controls.
Is it reasonably easy to support VoiceOver in Cocos2D's menu system, or should I look in to trying to create my menus in UIKit which I have no experience using?
I don't know if Cocos' menu system supports VoiceOver, but if it doesn't, you could probably add the functionality you're looking for yourself without having to delve into a lot of UIKit work. All you need to do is create a UIView subclass which gets added to your main window when your app starts up. Then use the UIAccessibilityContainer protocol and UIAccessibilityPostNotification calls to allow users to interact with your game via VoiceOver.
The UIAccessibilityContainer protocol lets you inform VoiceOver what interface elements are currently on the screen, their labels, their traits, etc. VoiceOver then uses this information to let users swipe between elements and get feedback on them.
When your game changes state, you can change what that protocol sends back and then issue a
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil)
...to inform VoiceOver that the screen layout has changed. And to just speak something via VoiceOver, say when your game state has changed, you can send a different notification to speak some text:
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, #"Achievement unlocked!");
No need to go with UIKit framework you can go with the cocos2d native methods and class to implement this.
For sound option we have SimpleAudioEngine Which can be used. you can distinguish between sound using its ID which is of type ALuint.
ALuint soundEffectID;
//to start
soundEffectID=[[SimpleAudioEngine sharedEngine] playEffect:#"my sound"];
//to stop
[[SimpleAudioEngine sharedEngine] stopEffect:soundEffectID];
You have to mange these effect and I think your problem will be solved.