I have an actionsheet popup in my iphone application. I would like to fill it with strings from an array instead of predetermined values.
I can’t find anything online to do this! Perhaps actionsheet isn’t the right thing to use?
Right now this is what I’m using to build it:
roomspopup = [ [ UIActionSheet alloc ] initWithTitle: alertname delegate: self cancelButtonTitle: @'Cancel' destructiveButtonTitle: nil otherButtonTitles: @'Kitchen', 'Dining Room', nil ];
But, instead of ‘Kitchen’ and ‘Dining Room’ I’d like it to fill in from an array. The size of the array (i.e. the number of rooms) is not a fixed number.
You can’t do it in one line. You’ll have to call
initWithTitlewith an empty set of buttons, and then add your other buttons with loop usingaddButtonWithTitle:.