views:

57

answers:

1

When users begin a specific action in my iPhone app, I am using a UIAlertView to display a help message with two button options: "OK" and "Don't Display Again", so the user can choose whether or not see the help message the next time they begin that action. However, the UIAlertView buttons are divided equally within the screen space - so the "OK button takes up 50% of the screen width even though it only needs 25% while the "Don't Display Again" button's text is truncated due to its length.

What is the best way to change the width of the UIAlertView buttons, so the "Don't Display Again" message isn't truncated? Can I adjust the buttons' font size?

A: 

You can't change the width of the button with direct method, but you could make the alert view have 3 buttons. This will cause the buttons arranged vertically instead of horizontally, thus all will take 100% of the alert view's width.

There is also an undocumented .numberOfRows property, which you may set to 2 to arrange the two buttons vertically.

KennyTM
Do you have any experience as to whether using the .numberOfRows property will get your app rejected from the App Store?
Jason
@Jason: It will certainly be rejected, as Apple now scans strings in your app before entering reviews.
KennyTM