我想更改“取消”按钮的颜色,以及从照片库中选择图像时显示的其他按钮。我怎样才能做到这一点?

var imagePicker = UIImagePickerController()
imagePicker.delegate = sender as? protocol<UIImagePickerControllerDelegate, UINavigationControllerDelegate>
imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
imagePicker.allowsEditing = true
sender.navigationController?.presentViewController(imagePicker, animated: true, completion: nil)

最佳答案

目标C
AppDelegate.m中添加以下代码

[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

斯威夫特
AppDelegate.swift中,在application(_:didFinishLaunchingWithOptions:)中我放置了以下内容:
UINavigationBar.appearance().tintColor = UIColor.whiteColor()

如果要更改导航栏的文本颜色,请使用以下代码:
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()]

关于ios - 更改照片库按钮的颜色,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28514701/

10-09 00:28