Reputation: 13
I've created a simple navigation application, which alternates between two views through the use of push/popViewController. I've decided to add a background image, rather than a pattern or single colour, to both view controllers.
Is there a way to have the same backgrounds for both views, without them scrolling when the view changes? This way, it will look like the background stays still, while everything else slides over the top.
I haven't found any help on this issue, and the only idea I've come up with up to now is to attempt to use the app delegate (or, tenuously, the navigation controller) to draw the background, but my attempts to do such have all failed terribly.
Upvotes: 1
Views: 1239
Reputation: 5699
You could use a "root" view controller that manages all other view controllers in your app.
[rootVC.view addSubview:navController.view]
.Caveat: This should work, but "nesting" view controllers like this isn't really good practice. Read the discussion Abusing UIViewControllers, and search for "UIViewController Containment" for how to do it properly in iOS 5.
Upvotes: 0
Reputation: 1996
Maybe try to add image to application window
and set background color for both viewcontrollers
to clearColor
.
Upvotes: 1