Date
Jul. 21st, 2024
 
2024年 6月 16日

Post: iOS Waring: TabBar Item States

iOS Waring: TabBar Item States

Published 12:09 Sep 19, 2015.

Created by @ezra. Categorized in #Programming, and tagged as #iOS.

Source format: Markdown

Table of Content

在设置 TabBar 文字属性时,可能会遇到类似这样的警告:

button text attributes only respected for UIControlStateNormal, UIControlStateHighlighted and UIControlStateDisabled. state = 4 is interpreted as UIControlStateHighlighted.

这可能是因为你写了这样的代码:

UIBarButtonItem *item = [UIBarButtonItem appearance];
[item setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]} forState:UIControlStateSelected];

注意上述代码中使用了 UIControlStateSelected 这个状态,但警告中已经说明,在该情境中 按下状态 被认为是 UIControlStateHighlighted,因此我们只需要修改这个状态即可。

Pinned Message
HOTODOGO
I'm looking for a SOFTWARE PROJECT DIRECTOR / SOFTWARE R&D DIRECTOR position in a fresh and dynamic company. I would like to gain the right experience and extend my skills while working in great teams and big projects.
Feel free to contact me.
For more information, please view online résumé or download PDF
本人正在寻求任职 软件项目经理 / 软件技术经理 岗位的机会, 希望加⼊某个新鲜⽽充满活⼒的公司。
如有意向请随时 与我联系
更多信息请 查阅在线简历下载 PDF