更改照片库按钮的颜色
Change the color of Photo Library button
我想更改 "Cancel" 按钮的颜色以及从照片库中选择图像时显示的其他按钮的颜色。我怎样才能做到这一点?
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)
Objective - C
在您的 AppDelegate.m
中添加以下代码
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
Swift
在AppDelegate.swift
中,在application(_:didFinishLaunchingWithOptions:)
中我输入了以下内容:
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
如果您想更改导航栏的文本颜色,请使用以下代码:
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()]
我想更改 "Cancel" 按钮的颜色以及从照片库中选择图像时显示的其他按钮的颜色。我怎样才能做到这一点?
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)
Objective - C
在您的 AppDelegate.m
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
Swift
在AppDelegate.swift
中,在application(_:didFinishLaunchingWithOptions:)
中我输入了以下内容:
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
如果您想更改导航栏的文本颜色,请使用以下代码:
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()]