Create UIActionSheet 'otherButtons' by passing in array, not varlist

前端 未结 4 816
太阳男子
太阳男子 2020-12-22 22:20

I have an array of strings that I want to use for button titles on a UIActionSheet. Unfortunately, the otherButtonTitles: argument in the method invocation takes a variable

4条回答
  •  抹茶落季
    2020-12-22 22:57

    One little note: [actionSheet addButtonWithTitle:] returns the index of that button, so to be safe and "clean" you can do this:

    actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:@"Cancel"];
    

提交回复
热议问题