简体   繁体   中英

how do I have the navigationItem.titleView to be behind left and right bar button item

Is it possible to have the titleView to be behind the left and right bar button item on a navigation bar? I've set my titleView to have a width of 320 and it covers the left and right bar button item. I wonder if there is a way to move it to the back?

In my experiments, it appears that the titleView is always drawn after (above) the left and right bar button items. You could try spelunking the view hierarchy and using sendSubviewToBack: , provided that the title view is ever made part of the navigation bar's hierarchy.

If you can render the effect you're trying to achieve into an image, you could set that as the backgroundImage of the navigation bar, but this may not be practical.

Remember that you'll likely need to account for interface rotation in any case, since the navigation bar height (on iPhone) goes from 44px in portrait to 32px in landscape).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM