简体   繁体   English

在UINavigationController层次结构中共享公共背景图像?

[英]Sharing a common background image in a UINavigationController hierarchy?

I know it's possible to set a background image for the UINavigationBar, but I would like to know if there is a way to share a common background view for all controllers in a UINavigationController. 我知道可以为UINavigationBar设置背景图像,但是我想知道是否有一种方法可以为UINavigationController中的所有控制器共享通用背景视图。 The idea is to have a UIImageView as the background that stays in place rather than "sliding" over itself when navigating to a new controller. 这个想法是让UIImageView作为背景,并且当导航到新控制器时,将其留在原处,而不是在其自身上“滑动”。

A navigation controller is a kind of view controller and it hosts the currently visible view controller by adding the VC view to its view. 导航控制器是一种视图控制器,它通过将VC视图添加到其视图中来承载当前可见的视图控制器。 You can add things to that view too. 您也可以在该视图中添加内容。 Create your image view and add it as a subview of the nav controller view, then send it to the back (or insert at index 0). 创建图像视图并将其添加为导航控制器视图的子视图,然后将其发送到背面(或在索引0处插入)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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