- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用自定义按钮类型,因为我需要触摸区域是非矩形的,所以我使用了一个名为 OBShapedButton
的类,这是我无耻地在网上找到的。但是,我还想为这些按钮着色以匹配玩家的颜色。
当谈到 UIButton
和 tintcolor
时,Apple's docs说
This property has no default effect for buttons with type
UIButtonTypeCustom
. For custom buttons, you must implement any behavior related totintColor
yourself.
那么我该如何自己实现这种行为呢?
最佳答案
您可以在您的类中使用 UIColor 创建一个颜色数组,然后单独访问它们,您尝试过这种方式吗?
好吧,像这样的例子
UIBarButtonItem.appearance().tintColor = UIColor.yellowColor()
最好你也可以发布你的类(class)代码
关于ios - 如何为 UIButtonTypeCustom 实现 tintcolor 行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26997497/
根据标题。 使用外观代理设置我的app tint color有什么好处[[UINavigationBar appearance] setTintColor: 相对于 self.view.tintCol
有没有人设法为 UISearchBar 的范围栏部分着色,它有一个 tintColor 属性,但设置它不会影响附加的范围栏 UISegmentedControl。我在酒吧上有一个 Handlebars
我尝试了很多方法,但都没有解决我的问题。我收到警告: Failed to set (tintColor) user defined inspected property on (UINavigatio
我有一个自定义图标(.png 图像)作为栏按钮,我将使用 Theme.swift 文件为 1 个特定 View Controller 设置资源颜色/背景颜色,但由于某种原因,色调颜色不是正在更新。 当
QLPreviewController * preview = [[QLPreviewController alloc] init]; preview.dataSource = self; previ
我在让 UISegmentedControl 显示所需的色调时遇到问题。 // AppDelegate - (BOOL)application:(UIApplication *)application
我将窗口的色调颜色设置为任意颜色,然后尝试在每个按钮的基础上覆盖它,但似乎只要应用了 segue,按钮就会恢复为窗口色调颜色在他们身上。 在 didFinishLaunchingWithOptions
我正在从服务器接收图像,然后根据用户选择的颜色,图像颜色将被更改。 我尝试了以下方法: _sketchImageView.image = [_sketchImageView.image imageWi
我正在尝试更改 watch 应用程序复杂功能(模块化大型高身)中的文本颜色,但无论我做什么,文本都保持白色。 这是我的代码,包含 tintColor 的行,我已经一起尝试了它们,并且每个都一个接一个。
我有 4 个图标。我希望它们在选择时具有不同的“突出显示”颜色。 我怎样才能实现这个目标? 最佳答案 在您呈现的VC中的viewWillAppear中: override func viewWillA
出于某种原因,我无法在 View 上使用 UINavigationBar,而是使用 UIToolBar。我使用带有清晰 tintColor 的虚拟左按钮和带有黑色 tintColor 的标题按钮来正确
我为 UINavigationController 创建了一个子类,我在其中更改了栏的颜色。 - (void)viewDidLoad { [super viewDidLoad]; se
我正在尝试将所选段的 UIsegmentedControl 色调颜色设置为渐变颜色,但我无法做到这一点 我正在尝试关注这篇文章 https://www.bethedev.com/2019/02/set
我正在使用以下代码创建一个 UIBarButtonItem: UIBarButtonItem* searchBarButton = [[[UIBarButtonItem alloc] initWith
我正在尝试使用自定义颜色更改标签栏的颜色,但似乎没有办法... 我以这种方式为 UIColor 类定义了一个类别: @implementation UIColor (UakariColor) +(UI
我的 SearchBar 的 TintColor 有问题。我在导航栏和搜索栏中使用相同的 RGB 颜色。正如您在下面看到的,颜色不一样。 这是我用来设置导航栏 TintColor 的代码: s
我的类(class)有一个 tintColor 函数: func pinColor() -> UIColor { switch status.text! { case "online
我的导航栏中有一个 UIBarButton,我从 Storyboard 中为其设置了一个图像 (silhouette.png),并且我可以随意更改该图像的色调(颜色): if let num2
我有一个 UIBarButtonItem 定义如下: let cardNavButton: UIBarButtonItem = UIBarButtonItem(image: UIImage(named
我有一个继承自 UIButton 的自定义 class。我想要完成的事情是根据按钮的启用状态(即启用或禁用)设置 tintColor 属性。 有什么办法可以实现吗? 这是我的课: class Butt
我是一名优秀的程序员,十分优秀!