Switch XIB's fading through Black?

I am attempting to switch views (XIB's) while fading through black. I have been doing this using UIView animations and I want to keep it that way. The problem is that whenever I switch views I am not fading through black, its more of a fade directly to the next XIB.

How would I properly do this?

Here is my code (self.view = view1.view in my case, but maybe I shouldn't do that):

[self.view setBackgroundColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:1.0]];
    [UIView animateWithDuration:0.4 
                         [view1.view setAlpha:0];
                     completion:^(BOOL finished){
                         [self.view.superview addSubview:view2.view];
                         [view2.view setAlpha:0];
                         [view2.view setFrame:CGRectMake(0, 0, 320, 480)];
                         [UIView animateWithDuration:0.4 
                                              [view2.view setAlpha:1];  
                                          completion:^(BOOL finished){
                                              [view1.view removeFromSuperview];



I think your problem is that the background color of self.view is part of that view. When you fade the view, it fades the background too.

Instead, you should put a view that you keep on the screen all the time, that's empty and has a black background color, and is behind view1 or view2.

Need Your Help

Play Framework 2.4 sending email

scala email playframework-2.4

I'm new to Scala and I got stuck in sending an email...

Converting windows sockets to .NET

c# sockets

I have a pretty simple sockets connection that seems to work under WinSock 2.0 but not at all under .NET. The only thing I know is one works and the other does not at all, but I'm not sure how to ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.