解决方法
最后我通过使用UIAlertController得到了答案:
UIAlertController *customActionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction *firstButton = [UIAlertAction actionWithTitle:@"First Button" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { //click action }]; [firstButton setValue:[UIColor blackColor] forKey:@"titleTextColor"]; [firstButton setValue:[UIColor blackColor] forKey:@"imageTintColor"]; [firstButton setValue:@true forKey:@"checked"]; UIAlertAction *secondButton = [UIAlertAction actionWithTitle:@"Second Button" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { //click action }]; [secondButton setValue:[UIColor blackColor] forKey:@"titleTextColor"]; UIAlertAction *cancelButton = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action){ //cancel }]; [cancelButton setValue:[UIColor blackColor] forKey:@"titleTextColor"]; [customActionSheet addAction:firstButton]; [customActionSheet addAction:secondButton]; [customActionSheet addAction:cancelButton]; [self presentViewController:customActionSheet animated:YES completion:nil];
这就是结果:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。