Xcode 4 Navigation item prompt property misbehaving?

回眸只為那壹抹淺笑 提交于 2019-12-24 10:01:41

问题


When designing in Interface Builder and you add text to a prompt property, it creates an additional top title. This comes with the extra thickness needed to allow for 2 tiles in the navigation bar.

Once I remove the text, let's say to reset back to the way it was, it keeps that thickness even though there is no text there. At runtime switching views makes the bar grow and shrink, which isnot nice.

My question is, how do you reset this back to a default single line thickness bar?

Thank you Jim


回答1:


In case anyone else has this problem...2 options

1 Fix unremoved xml in xib direct

A workaround, if this is a bug is to edit the *.xib file...as xml you can delete the entry left behind and seems to reset without issue...

e.g. To be sure, add value like "FOO BAR" and search for that in the text editor to find the key.

(take usual backup & care & own risk ofcourse)

(submitted online bug to apple for assessment)

2 Runtime programatic fix suggested by Drew C i.e. set self.navigationItem.prompt = nil




回答2:


In the Attributes Inspector pane of IB, change the value for Top Bar to "Navigation Bar" instead of "Navigatin Bar with Prompt"

Edit: See photo below-



来源:https://stackoverflow.com/questions/6419849/xcode-4-navigation-item-prompt-property-misbehaving

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!