OGeek|极客世界-中国程序员成长平台

标题: ios在呈现事件套件时更改导航栏项目的颜色 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:57
标题: ios在呈现事件套件时更改导航栏项目的颜色

我使用它是为了通过我的移动应用程序在我的日历上添加事件。 我想要做的是改变导航栏项目的颜色(取消和完成)请检查下图:enter image description here

有什么建议吗?



Best Answer-推荐答案


使用此代码

[self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];

如果你正在展示 UIViewController 然后使用下面的代码:

创建一个UIBarButtonItem

UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle"Cancel" style:UIBarButtonItemStylePlain target:self actionselector(cancelButtonTapped];

[barButton setTintColor:[UIColor whiteColor]];

如果你使用的是 Apple 提供的 UIViewController 那么这段代码:

  UIImagePickerController *controller = [[UIImagePickerController alloc] init];
        [controller setDelegate:self];
        [controller setSourceType:UIImagePickerControllerSourceTypePhotoLibrary | UIImagePickerControllerSourceTypeSavedPhotosAlbum];
        [controller.navigationBar setTintColor:[UIColor redColor]];

关于ios在呈现事件套件时更改导航栏项目的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25053852/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4