Tag: uiactionsheetdelegate

更改UIActionSheet中的项目颜色 – iOS 8

我一直在使用下面的代码来更改UIActionSheet添加的项目的文本颜色。 – (void)willPresentActionSheet:(UIActionSheet *)actionSheet { for (UIView *subview in actionSheet.subviews) { if ([subview isKindOfClass:[UIButton class]]) { UIButton *button = (UIButton *)subview; [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; } } } 它在iOS7工作正常,但在iOS8上面的代码不会更改项目的文本颜色。 现在我的问题是如何改变UIActionSheet使用iOS8添加的项目的文本颜色? 附加信息: 我添加了断点来查看是否执行上面的代码中的以下行: UIButton *button = (UIButton *)subview; [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 这些行不会被执行。 所以, if([subview isKindOfClass:[UIButton class]])对于actionSheet.subviews所有项目总是为false 。 所以我认为UIActionSheet的观点已经改变了。