youknowone / UI7Kit

Backport flat-style UIKit from iOS7 to iOS5+
Other
1.67k stars 199 forks source link

UI7ActionSheet addButtonWithTitle: issue #118

Open angeloalduino opened 11 years ago

angeloalduino commented 11 years ago

When using a UIActionSheet with the usual initializer of initWithTitle:delegate:cancelButtonTitle:destructiveButtonTitle:otherButtonTitles:, things work as expected. However, if you pass nil for otherButtonTitles and programmatically add them later (but before presenting), it renders incorrectly.

A workaround is to call setCancelButtonIndex (and setDestructiveButtonIndex if necessary) after adding other button titles. These indexes need to be set as your total button count, even though they will actually show up at the top of the list and report an index of 0 or 1.