Search code examples
iphoneiosobjective-cuibuttonuiactionsheet

How to create action sheet Delete in IOS


I want to create action sheet same bellow picture with Delete button red color and Cancel button. How can i do that? Thanks much

I want to create action sheet same bellow picture with Delete button red color and Cancel button. How can i do that? Thanks much


Solution

  • Simply use that code make make delete button as destructiveButton

    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure you want to delete this backup?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete Backup" otherButtonTitles:nil,nil];
    actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
    [actionSheet showInView:self.view];