views:

52

answers:

3

When I've learned that I have to write some code to make the iphone keyboard go away. I was quite surprised. I was surprised even more when it become apperent that it is just the top of the iceberg.

What are the expected UI behaviors that aren't provided by system OOTB?

Is the list below complete?

The expected UI behaviors:

  • Focusing next text field when [done] is hit
  • Hiding the keyboard when background is hit
  • Using Touch Up Inside to fire a button action. (To give user opportunity to change his/her mind)
  • Supporting the screen rotation.
A: 

Want a rounded rectangular button that isn't white? Since that one uses a background image, you can't just click something somewhere that makes it the color of your choice. You have to create your own image or you could even use CSS (WTF!?) to do it.

bpapa
You can create an image with a rounded rectangle using CoreGraphics, or make a layer have rounded corners using the cornerRadius property, or you could use a mask or any of a number of other ways. But programming is hard, let's go shopping!
rpetrich
Yeah, forgot to mention that, I was just so excited to write about the CSS trick that the Apple dev evangelist I missed it. Anyway it's still not as easy as ticking a color picker in Interface Builder and then... yeah, go shopping.
bpapa
A: 

Unfortunately, the iPhone SDK lacks a lot of helpful things one would think would just be there. However, many people have taken the time to write wrappers for many of these kinds of things to help facilitate development - a quick google search into the functionality you are expecting may turn up a lot of useful answers!

For example, you could make the keyboard go away when you tap outside of it by creating a new view when it appears, and placing that view behind any user-interactable views on the screen. When that new view is tapped, it will become first responder and cause the keyboard to slide away (because the UITextField is no longer first responder).

Such a thing could be easily implemented as a drop-in fix for pretty much anything you'd need it for with very little code.

Still should have been included in the SDK in the first place, though!

PfhorSlayer
+1  A: 

Some of that is silly, but some of it has uses as well.

Focusing next text field when [done] is hit
Which field is "next"? If you have a large form with fields both next to and above/below each other, next might not be so obvious. Even if they are in some linear layout, the iPhone would have to work to figure out which one is next. Do you want to wrap around at the end of the form, or dismiss the keyboard, or submit the form?

Hiding the keyboard when background is hit
I mostly agree with you here, though there are a few cases where this is useless. For example, adding a new phone number in the contact app.

Using Touch Up Inside to fire a button action
This one I really don't get. I can only guess that it's designed to allow you to use buttons instead of the touchesBegan/Moved/Ended methods. I guess it could be useful, but I've never used anything but Touch Up Inside.

Supporting the screen rotation
Many apps just don't work in any other orientation, such as games. If you want to use rotation, you only have to add two lines of code assuming you've done your layout well.

I hope this helps explain some of the strangeness. Aside from the keyboard dismissal, I've never really found anything too annoying. The one thing I wish they supported was using the highlight state of UIButtons for the set state. It would be a quick and easy toggle button, but I've taken to screenshotting a highlighted button and using that for the background image of a selected button.

David Kanarek
I know how to implement the behaviors I mentioned. I was asking about other bahaviors that are expected by users and are not provided by iphone os.
Piotr Czapla
I don't think it came across, but my post was more an explanation as to why this stuff doesn't happen automatically. The toggle state for buttons is the only one that annoys me. There should be some default "on" indicator for UIButtons in my opinion.
David Kanarek
touch down in a button is used in apps that emulate a music instrument. So it is good that Apple doesn't force you to use touch up in a button.All of these choices are to add flexibility to the programmer.
Jay