Illep
Illep

Reputation: 16851

How to change the button in UIActionsheet

I have a UIActionsheet. I need to change the colour of the buttons in it.

-(IBAction)showActionSheet:(id)sender {

    UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Title" delegate:self cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:@"Destructive Button" otherButtonTitles:@"Other Button 1", @"Other Button 2", nil];

    popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;

    [popupQuery showInView:self.view];

    [popupQuery release];

}

The UIActionsheet displays as this. a red button followed by 2 grey buttons and black cancel button. I need the first 3 buttons to be grey and the last button black. How can i do this programatically ?

Upvotes: 0

Views: 726

Answers (1)

Mark Adams
Mark Adams

Reputation: 30846

Destructive buttons are automatically styled in red. When creating your action sheet, set the destructive button title to nil and only use the otherButtonTitles argument for the 3 gray buttons.

Upvotes: 3

Related Questions