我有一个UIActionSheet
我有条件地添加按钮的。如果有很多按钮(纵向视图更是如此),破坏性按钮会从操作表中分离(如预期的那样)以允许项目滚动。不正确的事情是它没有背景。
UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:nil
delegate:self
cancelButtonTitle: nil
destructiveButtonTitle:@"Changed my mind"
otherButtonTitles:MAILBUTTON, BOOKMARKSBUTTON, CLEARCOOKIESBUTTON, nil];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
[sheet addButtonWithTitle:CAMERABUTTON];
}
sheet.tag = ACTION_SHEET;
if ([UIPrintInteractionController isPrintingAvailable])
{
[sheet addButtonWithTitle:PRINTBUTTON];
}
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
if ([prefs boolForKey:BUMP_ENABLED_KEY] == YES)
{
[sheet addButtonWithTitle:BUMPRECEIVEBUTTON];
if ([prefs boolForKey:BUMP_ALLOW_SENDING_KEY] == YES)
[sheet addButtonWithTitle:BUMPSENDBUTTON];
}
[sheet addButtonWithTitle: @""];
[sheet setCancelButtonIndex: sheet.numberOfButtons - 1];
[sheet showInView:self.view];
在纵向模式下看起来不错,破坏性按钮有背景。如果我添加更多按钮,它具有与上面相同的行为。