views:

1242

answers:

1

Is it possible to create a custom textfield on the iPhone? What I would like to do is have an "alertview" that looks like it fits in with the app design and using an image as the dialog box/alert, not just the standard alertview. So, I'll handle all the graphics and input handling, but how does one pop up the keyboard and deal with input without creating a TextField?

Side question - is this going to run afoul of Apple's input standards?

Thanks in advance, Ben

+4  A: 

UITextField is already very customisable. I'm not sure you need to sub-class it.

In addition to its own properties to control the text and overlays, UITextView is a subclass of UIView so you can control the background colour and add your own subviews. If you do the latter, you must be careful about breaking the event handling within UITextView.

UITextView also handles all the keyboard behaviour you should look at UIKeyboardWillShowNotification and related notifications.

Nobody can say what Apple will and won't accept but as long as your custom UI is clear and usable, you should be OK

Roger Nolan