Here's my problem: I've actually created a custom segue
to manage in a different way the transitions between my UIViewControllers
(I'm working on a Storyboard
based project). I added some animations using CATransform3D
to move the views...so...when I do that, the only thing I can see in the background is a black view.
I would love to know how to change that color and if is possible to replace it with a UIImageView
. Do you have any trick/idea to do that?
Thanks! :)
You can try following if you are sure the black view is a root controller's view:
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"my_image"]];
UIView *rootView = [[UIApplication sharedApplication].keyWindow.rootViewController.view];
[rootView insertSubview:imageView atIndex:0];
Actually,this is a grave, but I would leave the answer for later-comers.
We know that iOS is migrated from OS X, so all viewControllers are in UIWindow
, the black color
is the backgroundColor of the window
. so that you should not
find any root viewController
, what you find is the top window
.
if you want to change the black backgroundColor to other color
, like white, do:
UIWindow *window = [[UIApplication sharedApplication].windows lastObject];
window.backgroundColor = [UIColor whiteColor];
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.