set "default" UIViewController background image?
Basically I've got the same background image throughout my entire iphone application.
I don't use XIBs (nasty things :p).
So I was wondering if there was any way to add a "default" background image to all of my UIViewControllers?
I tried subclassing UIViewController and created the class UIVi开发者_Go百科ewControllerWithDefaultBackground, but changing over all my uiviewcontrollers to subclass UIViewControllerWithDefaultBackground just crashes my app. Plus half of my views are UITableViewControllers... but I'd be happy just having to change 2 classes... :p
Is there any way of doing this? I just don't want to have to copy and paste the same 3 or 4 lines of code into every single class I'm initiating. Plus, if I want to edit it at any point (take out the navigation bar and extend the view lets say) then I would have to change all my different classes.
Is there no easy way to do this programatically?
Thanks Tom
If you add a UIImageView to your UIWindow in your app delegate (make sure it's below the root view), then make sure all your VC's are opaque, that should solve your problem.
This would be easier to do in IB, especially if you have a MainWindow .xib already created (albeit blank)--you just drag and drop the image into the UIWindow.
精彩评论