Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 01-08-2011, 09:13 AM   #20 (permalink)
Poatface
What?
 
Join Date: Nov 2010
Posts: 5
Poatface is on a distinguished road
Talking

Quote:
Originally Posted by colionel View Post
This is really simple, since OS 3.0 just set the background color of the cell in the willDisplayCell method.
You must not set the color in the cellForRowAtIndexPath.

This works for both the plain and grouped style :

Code:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
	cell.backgroundColor = [UIColor redColor];
}

P.S: Here the documentation extract for willDisplayCell :

"A table view sends this message to its delegate just before it uses cell to draw a row, thereby permitting the delegate to customize the cell object before it is displayed. This method gives the delegate a chance to override state-based properties set earlier by the table view, such as selection and background color. After the delegate returns, the table view sets only the alpha and frame properties, and then only when animating rows as they slide in or out."
This is fantastic! Thank you so much for posting this.
Poatface is offline   Reply With Quote
 

» Advertisements
» Online Users: 448
14 members and 434 guests
Ananth, antonwilliams, carmeliaxw97, Chickenrig, dre, heshiming, Paul Slocum, Pitter20, Renrob, RETRO, ryantcb, st.Jimmy, UconnAggie, waterkamp
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,594
Threads: 94,083
Posts: 402,778
Top Poster: BrianSlick (7,990)
Welcome to our newest member, kopmlop
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:44 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.