Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kaydell.leavitt

macrumors regular
Original poster
Apr 19, 2010
100
0
I want to play a sound to the user when I reject their input.

(Like the old function SysBeep() for classic Mac OS).

I need to learn how to play a simple sound that is consistent across apps to tell the user that their input was not accepted.

Any ideas?

-- Kaydell
 
I need to learn how to play a simple sound that is consistent across apps to tell the user that their input was not accepted.

Do you even own an iPhone? Which apps play a sound to indicate rejected input? What happens when the phone is on silent? The answers to these questions should make it clear whether you should be doing this or not.

Oh and forget anything about classic Mac programming. This is nothing like that.
 
Alerts are Better Than Beeping

... forget anything about classic Mac programming. This is nothing like that.

OK, I'll forget beeping at the user and put up an alert.

Do you agree that I'm on the right track?

Code:
void alert(NSString *title, NSString *message) {
	UIAlertView *alert = [[UIAlertView alloc]
		initWithTitle: title
		message: message
		delegate: nil
		cancelButtonTitle: @"OK"
		otherButtonTitles: nil
	 ];
	[alert autorelease];
	[alert show];
}
 

Also if possible use one of the provided keyboards that, as much as possible, only has the characters you want. If you need one or two additional keys use the notifications for the keyboard appearing/disappearing to add your own view with the additional key/keys.

To be honest I've lost track of exactly what you want. iirc you basically want UIKeyboardTypeNumberPad with a couple of extra keys...
 
...you basically want UIKeyboardTypeNumberPad with a couple of extra keys...

I've decided to "go with the grain" and use the ASCII keyboard. I have some error-checking in case the user types in bad characters. I think that my orginal approach was't as good because there are other decimal points etc, I'll let the user select their locale in the System Preferences and then let the NSNumberFormatter do the conversions from and to NSString from doubles and now, I don't have to worry about filtering individual characters since that might break things for some locales.

I think that I'm done with my simple app and I'm going to make it free and then make a 99 cent version and sell it at the app-store.

I believe that I will sell more if I have a free app and then sell an upgrade to a paid app.

-- Kaydell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.