【问题标题】:Matching keyboard accessory view background color with keyboard color将键盘附件视图背景颜色与键盘颜色匹配
【发布时间】:2014-07-09 06:12:59
【问题描述】:

我正在尝试在默认 UIKeyboard 之上放置一个附件视图。我想将附件视图的背景颜色与 iOS 6 和 iOS 7 的键盘颜色匹配。我正在尝试使用低于 RGB 的颜色,但没有帮助。

如果有人以前这样做过,请提出建议。

For iOS 6
myAccessoryView.tintColor = [UIColor colorWithRed:105.0f/255.0f green:114.0f/255.0f blue:125.0f/255.0f alpha:1.0f];

For iOS 7
myAccessoryView.tintColor = [UIColor colorWithRed:(81.0f / 255.0f) green:(81.0f / 255.0f) blue:(81.0f / 255.0f) alpha:0.98f]

【问题讨论】:

    标签: ios objective-c cocoa-touch uiview uikeyboard


    【解决方案1】:

    对于 iOS7,您可以使用 UIInputView。要支持 iOS6,您将不得不投入更多的工作,基本上是继承 UIToolBar 并设置正确的 tintColor。更多信息请见How to extend keyboard gradient on iPhone?

    【讨论】:

    • 你知道如何在UIInputView 中添加UIToolbar 吗?如果我只是做uiInputView.addSubview(uiToolbar),工具栏不会出现
    • 如果我还设置了一个框架(或使用自动布局约束),它对我有用。如果您仍然遇到麻烦,最好提出一个新问题:)
    猜你喜欢
    • 2018-05-23
    • 2017-11-04
    • 2016-12-03
    • 2013-03-25
    • 2012-04-01
    • 1970-01-01
    • 2019-03-22
    • 2011-08-05
    • 2023-02-13
    相关资源
    最近更新 更多