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?
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.
精彩评论