我的自定义栏按钮项目中的“导航项目中不支持平原样式”警告(“Plain Style unsupported in a Navigation Item” warning with my customiz

编程入门 行业动态 更新时间:2024-10-24 22:18:40
我的自定义栏按钮项目中的“导航项目中不支持平原样式”警告(“Plain Style unsupported in a Navigation Item” warning with my customized Bar Button Item)

我将一个Round Rect按钮拖到正确的Bar Button Item的位置,并将一个图像设置为Round Rect按钮。 所有功能都很好,除了“导航项目中不支持的普通样式”警告。 即使我将条形按钮项目的样式选为“边框”,警告仍然存在。 Xcode 4.2有什么问题? 提前致谢!

PS。 我使用Round Rect按钮定制了许多Bar Button项目,有些时候Xcode 4.2在Bar Button项目中只显示一个警告,有时候会在所有的Bar按钮项目上显示警告。

I drag a Round Rect Button to the position of the right Bar Button Item, and set an image to the Round Rect Button. All works well, except the warning "Plain Style unsupported in a Navigation Item". Even if i select the style of the Bar Button Item to "Bordered", warning still be there. What's the matter with Xcode 4.2? Thanks in advance!

Ps. I customized many Bar Button Items with Round Rect Button, some times Xcode 4.2 shows only one warning on a Bar Button Item, some times shows warnings on all Bar Button Items.

最满意答案

我能够通过手动编辑故事板文件并在<navigationItem>元素中的Bar Button项目上找到违规样式=“plain”条目来删除这些错误。

更改自:

<barButtonItem key="rightBarButtonItem" style="plain" id="juB-DL-F9i">

至:

<barButtonItem key="rightBarButtonItem" id="juB-DL-F9i">

这清除了警告...对或错。

这可能是一个巨大的黑客,更大的关注是我没有根本原因,或从整个文档中删除隐形的按钮项。 这是经过所有元素后,发现一些导航栏是空的(没有孩子),可能会发生大量的复制和粘贴(cmd + c | v)继承而不使用重复(cmd + d)构建界面。 虽然源的原因不是由根引起的,但是在文件“大纲视图”中没有显示的条形项目被修正。 界面生成器的行为有时会令我微不足道,而一个空的容器,在大纲视图中应该有一些东西是一种气味。 那是现在给我的。 有时删除违规节点和重建修复最奇怪的问题。

警告:在你尝试这个之前备份你的故事板?版本控制是你的朋友...当你的故事板完全被踩踏并且不编译时,我不承担任何责任。 所有你会得到的是一个“我告诉你了! 我学到了艰难的方法几次,但勤奋的源头控制救了我头痛。

编辑:将代码块中的括号

I was able to remove these errors by manually editing the storyboard files and find the offending style="plain" entry on Bar Button items in the <navigationItem> element.

Changed from:

<barButtonItem key="rightBarButtonItem" style="plain" id="juB-DL-F9i">

To:

<barButtonItem key="rightBarButtonItem" id="juB-DL-F9i">

This cleared the warnings... right or wrong.

This may be a stupendous hack and the larger concern is I did not root cause it or remove the invisible bar button items from the overall document. This was after going through all the elements one by one and discovering some navigation bars were empty (without children) and likely occurred with the large amount of copy and paste (cmd+c|v) inheritance and not using duplicate (cmd+d) to build the interface. Although the source cause was not root caused, the symptom was the bar items did not show in the document "outline view" to be fixed. Interface Builder behavior strikes me as nuanced at times and an empty container where there should be something in an outline view is a smell. Well it is to me now. Sometimes deleting the offending node and rebuilding fixes the oddest issues.

WARNING: back up your storyboards before you try this... version control is your friend... I take no responsibility when your storyboard is completely hosed and wont compile. All you'll get is an "I told you so!" I learned the hard way a few times, but diligent source control saved me a headache.

EDIT: put brackets in code blocks

更多推荐

本文发布于:2023-08-04 07:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1412465.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   自定义   中不   平原   样式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!