How to change background color of top and bottom side of tableview?

I changed tableview cell color. But when I move to up or down side of tableview, it is still white. How can I change that empty space color programmatically?

Answers


If you want a different color of table and cell, just say tableView.backgroundColor = desiredColor. The UIColor class offers class methods like +blueColor, +redColor, and such.

If you want the same color of the table and its cells, keep the code above and add this in tableView:cellForRowAtIndexPath:

// Customize the cell
cell.backgroundColor = [UIColor clearColor];
for (UIView *subview in [cell subviews]) {
    subview.backgroundColor = [UIColor clearColor];
}

This is a better solution than simply saying cell.backgroundColor = desiredColor because if you decide to use a view (such as a pattern), instead of just a color, as the background of your table, the background will be visible at all times, not just when you bounce the content.


Need Your Help

Set migrate:safe to user defined table in waterline

waterline node-mysql

I have to create user defined tables in waterline though custom query method(.query()).

Why don't named .NET mutexes throw AbandonedMutexException when disposed?

.net synchronization mutex abandonedmutexexception

I don't understand why the .NET mutex does not either throw an AbandonedMutexException in one of the waiting threads or release the mutex when Mutex.Dispose() is called.

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.