使用如下方法定义UIActionSheet,其中颜色按钮的颜色为红色。
UIActionSheet *ActionSheet = [[UIActionSheet alloc] initWithTitle:@" "
delegate:selfcancelButtonTitle:@"删除"
destructiveButtonTitle:@"颜色"
otherButtonTitles:@"Done",nil];
[ActionSheet setActionSheetStyle:UIActionSheetStyleDefault];
1、修改颜色按钮的颜色为默认的蓝色的方法
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
[sheet addButtonWithTitle:@"颜色"];
[sheet addButtonWithTitle:@"删除"];
sheet.cancelButtonIndex = sheet.numberOfButtons-1;
2、修改按钮的颜色为其他颜色的方法
实现代理方法
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet
{
for (UIView *subViwe in actionSheet.subviews) {
if ([subViwe isKindOfClass:[UIButton class]]) {
UIButton *button = (UIButton*)subViwe;
[button setTitleColor:[UIColor blueColor]
forState:UIControlStateNormal];
}
}
}