user717452
user717452

Reputation: 111

Change Background Color of iOS App When Pushing Views

In my app, I use a navigation controller to switch between different views. Each of my views has an image for a background, but when I go from one to another, a little bit of white shows up in between them while transitioning. Is there a way to change that?

In the Table View Class I have this in the viewDidLoad:

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"parchment.png"]];
    self.tableView.backgroundColor = [UIColor clearColor];
    self.tableView.backgroundView = imageView;
    [imageView release];

In the detail view I have just a standard loadrequest for an HTML. The HTML itself has the code for the parchment paper to be a background image. Here is what they look like:

enter image description here

enter image description here

But, going back from the detail view with the verses to the table view, I get this: enter image description here

Upvotes: 2

Views: 15515

Answers (4)

Salman Zaidi
Salman Zaidi

Reputation: 9842

In your:

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

method of AppDelegate. assign background color to window like this:

self.window.backgroundColor = [UIColor blackColor]; // or anycolor

Upvotes: 9

user717452
user717452

Reputation: 111

The issue was in the viewWillDisappear of the web view controller. It was set to change webpage to about:blank page, which made it white. I got rid of that code, and it worked fine.

Upvotes: 3

Moxy
Moxy

Reputation: 4212

Try to set the background color of the navigation controller's view.

In your navigation controller's root view controller (I guess it's the table view controller)

self.navigationController.view.backgroundColor = // any color ; 

Upvotes: 0

Mick MacCallum
Mick MacCallum

Reputation: 130192

Have you tried changing the background color property of the view?

[[self view] setBackgroundColor:[UIColor redColor]];

Upvotes: 4

Related Questions