iOS developer
iOS developer

Reputation: 317

How to change UITableView's appearance?

What different kinds of things can you do to edit a tableview's appearance and how would you do them? For example, how would you change the color programmatically? Or change the navigation bar's color programmatically?

Upvotes: 2

Views: 4420

Answers (4)

Ton Snoei
Ton Snoei

Reputation: 3195

If you want to change the appearance of all TableViews in your app you can define it with the Appearance property. In Monotouch you do something like this:

UITableView.Appearance.BackgroundColor = UIColor.Black;
UITableViewCell.Appearance.BackgroundColor = UIColor.Black;

In objective C it would be something similar.

Upvotes: 1

Vineesh TP
Vineesh TP

Reputation: 7963

[tableView setBackgroundColor:[UIColor grayColor]];

or You can use,

[tableView setBackgroundColor:[colorWithRed:.98 green:.98 blue:.82 alpha:1]];

Upvotes: 1

chown
chown

Reputation: 52738

Check out the docs for UITableView and UITableViewCell.

You probaby want to change the backgroundColor property or customize each cells contentView property. Also,look into layers, you can do things like make rounded corners, shadows, etc on a views layer.

Here is the QuartzCore Framework docs. They should be useful if your trying to change the appearance of a view.


Edit (good suggestion bshirley):

AboutTableViewsiPhone

Upvotes: 3

user523234
user523234

Reputation: 14834

Check out Apple's doc on UITableView particularly the configuring A Table View section.

Upvotes: 1

Related Questions