UIActionSheet is not showing separator on the last item on iOS 7 GM

后端 未结 8 466
暗喜
暗喜 2020-12-03 04:31

It could be probably a bug on iOS7. But the last button is not separated from the previous one\"UIActionSheet

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-03 04:42

    It seems that the initWithTitle:delegate:cancelButtonTitle:destructiveButtonTitle:otherButtonTitles: method is buggy and you shouldn't specify any cancel button here at all. Btw, it seems that a destructive button set in that method also won't work very well.

    Instead of it you should:

    • provide a custom cancel button as the last button in the buttons array, eg: ["Action 1", "Action 2", "Close"] or sheet.addButtonWithTitle("Close")
    • manually set the cancel button index, e.g. sheet.cancelButtonIndex = 2

    Then everything will work as expected. On the iPad the button will be automatically hidden and on the iPhone it will be styled and placed in the proper way.

提交回复
热议问题