I'm creating an UIActionSheet
:
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"Choose region/city"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:nil, nil];
for (Cities *c in self.cities) {
[actionSheet addButtonWithTitle:c.name];
}
actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheet showInView:self.view];
I'm just setting the cities names as the buttontitle. The Cities array length is 8. The output is fine, but when I click on the first Button ( this one is called Auckland) it says it is a CancelButton.
The other buttons and the cancelbutton works fine, only the first one not. Both the Auckland button and the CancelButton
got a buttonIndex
of 0.
Can anyone tell me why this is? And how to fix it?
PS: If i do cancelButtonTitle:nil, its working fine. But i would like the Cancel button:)