UITableView – Clear Background

Filed in iOS

The other day I wanted to embed a UITableViewController into a UIViewController. The UIViewController had a background image on it, and I wanted the UITableViewController’s view to have a clear background. I tried setting the background color to [UIColor clearColor] and it worked in the storyboard, but at runtime, the background went to it’s default color. I then changed the background color to [UIColor redColor] just to see if it had something to do with clearColor. I ran that and it had the same effect.

Turns out that if you want to set the background color of a UITableView, you must remove the background view in order to see the background color that was set in Interface Builder. Here’s how I did it.

((UITableView*)view).backgroundView = nil;

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
WordPress database error Table '27178_beckerswebsite.wp_formbuilder_pages' doesn't exist for query SELECT * FROM wp_formbuilder_pages made by require('E:\inetpub\vhosts\beckerwebsite.com\httpdocs\wp-blog-header.php'), require_once('E:\inetpub\vhosts\beckerwebsite.com\httpdocs\wp-includes\template-loader.php'), do_action('template_redirect'), call_user_func_array, formbuilder_init, fb_is_active