In my NSOutlineview i am using custom cell which is subclassed from NSTextFieldCell,
I need to draw different color for group row and for normal row, when its selected,
To do so, i have done following ,
-(id)_highlightColorForCell:(NSCell *)cell
{
return [NSColor colorWithCalibratedWhite:0.5f alpha:0.7f];
}
Yep i know its private API, but i couldn't found any other way,
this is working very well for Normal Row, but no effect on Group Row, Is there any way to change the group color,
Kind Regards
Rohan
You can actually do this without relying on private API's, at least if your willing to require Mac OS X 10.4 or better.
Put the following in your cell subclass:
- (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
// Returning nil circumvents the standard row highlighting.
return nil;
}
And then subclass the NSOutlineView and re-implement the method, - (void)highlightSelectionInClipRect:(NSRect)clipRect;
Here's an example that draws one color for non-group rows and another for group rows
- (void)highlightSelectionInClipRect:(NSRect)clipRect
{
NSIndexSet *selectedRowIndexes = [self selectedRowIndexes];
NSRange visibleRows = [self rowsInRect:clipRect];
NSUInteger selectedRow = [selectedRowIndexes firstIndex];
while (selectedRow != NSNotFound)
{
if (selectedRow == -1 || !NSLocationInRange(selectedRow, visibleRows))
{
selectedRow = [selectedRowIndexes indexGreaterThanIndex:selectedRow];
continue;
}
// determine if this is a group row or not
id delegate = [self delegate];
BOOL isGroupRow = NO;
if ([delegate respondsToSelector:#selector(outlineView:isGroupItem:)])
{
id item = [self itemAtRow:selectedRow];
isGroupRow = [delegate outlineView:self isGroupItem:item];
}
if (isGroupRow)
{
[[NSColor alternateSelectedControlColor] set];
} else {
[[NSColor secondarySelectedControlColor] set];
}
NSRectFill([self rectOfRow:selectedRow]);
selectedRow = [selectedRowIndexes indexGreaterThanIndex:selectedRow];
}
}
Related
In iOS 9 all it takes to enable reordering a collection view is to implement moveItenAtIndexPath... like this...
override func collectionView(collectionView: UICollectionView,
moveItemAtIndexPath sourceIndexPath: NSIndexPath,
toIndexPath destinationIndexPath: NSIndexPath) {
print("sourceIndexPath= \(sourceIndexPath)")
print("destinationIndexPath= \(destinationIndexPath)")
}
But it doesn't seem to be enough in tvOS. What else needs to be implemented to enable reordering?
Here's the code from the view controller...
import UIKit
class ReorderableCollectionViewController: UICollectionViewController {
var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return numbers.count
}
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("CellReuseIdentifier", forIndexPath: indexPath) as! CustomCollectionViewCell
cell.backgroundColor = UIColor.yellowColor()
let number = numbers[indexPath.item]
cell.label.text = "\(number)"
return cell
}
override func collectionView(collectionView: UICollectionView,
moveItemAtIndexPath sourceIndexPath: NSIndexPath,
toIndexPath destinationIndexPath: NSIndexPath) {
print("sourceIndexPath= \(sourceIndexPath)")
print("destinationIndexPath= \(destinationIndexPath)")
}
override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) {
print("didUpdateFocusInContext")
coordinator.addCoordinatedAnimations({
if let previousItem = context.previouslyFocusedView as? CustomCollectionViewCell {
previousItem.backgroundColor = UIColor.yellowColor()
}
if let nextItem = context.nextFocusedView as? CustomCollectionViewCell {
nextItem.backgroundColor = UIColor.redColor()
}
}, completion: nil)
}
}
I was unable to use built in methods to enable reordering of collectionview/tableview cells. However, there's always an option for a custom solution. In my current project I have concept of focused cell and highlighted cell. Also I have a separate button to trigger moving of highlighted cell. Also I wanted to have a behavior similar to home screen where long tap triggers moving too. Here are most of the code snippets required to achieve the result:
The class inherits from UIView and has UICollectionView connected to playlistCollection property.
Core idea: The view has special flag for reordering state. When this flag is triggered, all focus changes are blocked. If focus was about to move to another cell - swap currently focused cell with the one that user tried to focus. Otherwise don't do anything (so that focus never leaves collection view unless it's in normal state).
Other option: Instead of swapping cells around, you can also swap their data in the model and reload the cells. Advantages of this is that you can move selected cell through the list much faster (at the speed of scrolling through the list), but reloading 2 cells causes a slight lag, hence I decided to use my current solution. If you want to try this solution out the code triggering the cell change has to be moved from shouldUpdateFocusInContext to didUpdateFocusInContext and only focus changes moving outside of collectionview must be forbidden (rather than all focus changes).
Hope this helps.
_pressureGestureRecognizer overrides default behavior for all the remote buttons that are accessible to the app (menu, play/pause, tap), therefore it's only enabled when view is reordering state.
#implementation PlaylistView {
int _highlightedCell;
UILongPressGestureRecognizer *_longPressGestureRecognizer;
UITapGestureRecognizer *_pressGestureRecognizer;
BOOL _isBeingReordered;
NSMutableArray *_data;
}
#synthesize isBeingReordered = _isBeingReordered;
- (void)setup {
_isBeingReordered = NO;
_data = [[NSMutableArray alloc] initWithCapacity:20];
for (int i = 0; i < 20; i++)
{
[_data addObject:[NSString stringWithFormat:#"Temp %i", i]];
}
_longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:#selector(longPressed:)];
[self.playlistCollection addGestureRecognizer:_longPressGestureRecognizer];
_pressGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(pressed:)];
_pressGestureRecognizer.allowedPressTypes = #[#(UIPressTypeMenu), #(UIPressTypeSelect), #(UIPressTypePlayPause)];
[self.playlistCollection addGestureRecognizer:_pressGestureRecognizer];
_pressGestureRecognizer.enabled = NO;
}
- (void)pressed:(UITapGestureRecognizer *)gesture {
if (!_isBeingReordered)
return;
_isBeingReordered = NO;
_pressGestureRecognizer.enabled = NO;
}
- (void)longPressed:(UILongPressGestureRecognizer *)gesture {
if (_isBeingReordered)
return;
_isBeingReordered = YES;
_pressGestureRecognizer.enabled = YES;
}
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
[super didUpdateFocusInContext:context withAnimationCoordinator:coordinator];
if ([context.nextFocusedView isKindOfClass:[PlaylistCell class]]) {
if (_isBeingReordered)
{
NSLog(#"This should never happen.");
}
else
{
int nextIdx = [self.playlistCollection indexPathForCell:context.nextFocusedView].row;
if (nextIdx != _highlightedCell) {
PlaylistCell *prevCell = [self.playlistCollection cellForItemAtIndexPath:[NSIndexPath indexPathForItem:_highlightedCell inSection:0]];
if ([prevCell highlighted])
prevCell.highlighted = NO;
}
_highlightedCell = nextIdx;
}
}
}
- (void)moveCellFromRow:(int)artwork offset:(int)offset {
if (artwork + offset >= 0 && artwork + offset <= [_data count] - 1)
{
[self.playlistCollection performBatchUpdates:^{
[self.playlistCollection moveItemAtIndexPath:[NSIndexPath indexPathForItem:artwork inSection:0] toIndexPath:[NSIndexPath indexPathForItem:artwork + offset inSection:0]];
[self.playlistCollection moveItemAtIndexPath:[NSIndexPath indexPathForItem:artwork + offset inSection:0] toIndexPath:[NSIndexPath indexPathForItem:artwork inSection:0]];
_highlightedCell += offset;
//if there are certain elements in the cells that are position dependant, this is the right time to change them
//because these cells are not reloaded by default (for example you have idx displayed in your cell... the cells will swap but idxs won't by default)
} completion:^(BOOL finished) {
NSString *temp = _data[artwork + offset];
_data[artwork + offset] = _data[artwork];
_data[artwork] = temp;
}];
}
}
- (BOOL)collectionView:(UICollectionView *)collectionView shouldUpdateFocusInContext:(UICollectionViewFocusUpdateContext *)context {
if (_isBeingReordered)
{
//code only supports vertical reording.
if (context.focusHeading == UIFocusHeadingDown)
{
[self moveCellFromRow:_highlightedCell offset:1];
}
else if (context.focusHeading == UIFocusHeadingUp)
{
[self moveCellFromRow:_highlightedCell offset:-1];
}
return NO;
}
return YES;
}
- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath {
//i have a custom code to handle highlights
return NO;
}
#end
I have a subclass of NSView named clickView as follows.
// clickView.h
#interface clickView : NSView {
BOOL onOff;
}
- (BOOL)getOnOff;
// clickView.m
- (BOOL)getOnOff {
return onOff;
}
- (void)mouseDown:(NSEvent *)event {
if (onOff) {
onOff = NO;
} else {
onOff = YES;
}
[self setNeedsDisplay:YES];
NSLog(#"%#",self.identifier);
}
It utilizes its drawRect method (, which is not shown here,) to fill the rectangle with a color if the user clicks on it. And it uses a boolean value (onOff) to see if it's been clicked on. Now, switching to AppleDelegate, I instantiate this NSView subclass as follows.
// AppDelegate.m
- (IBAction)create4Clicked:(id)sender {
NSInteger rowCount = 10;
NSInteger colCount = 10;
NSInteger k = 1;
for (NSInteger i2 = 0; i2 < rowCount; i2 ++) {
for (NSInteger i3 = 0; i3 < colCount; i3 ++) {
NSView *view = [[clickView alloc] initWithFrame:NSMakeRect(50+i2*10,50+i3*10,10,10)];
[view setIdentifier:[NSString stringWithFormat:#"%li",k]];
[view1 addSubview:view]; // view1 is NSView that's been created with Interface Builder
k++;
}
}
}
So I now have 100 squares displayed on view1 (NSView). If I click on any of the squares, I do get its identifier. (See 'mouseDown.') Now, what I need to figure out is how to tell which square has its 'onOff' set to YES (or NO).
Thank you for your help.
A. First off all:
Probably you are new to Cocoa and Objective-C.
a. Why don't you use buttons?
b. onOff is obviously a property. Why don't you use declared properties?
B. To your Q:
You can retrieve the views with a specific state by asking the superview for its subviews and then filter them with a predicate:
NSPredicate *clickedPredicate = [NSPredicate predicateWithFormat:#"onOff == %d", YES];
NSArray* clickViews = [view1 subviews]; // Returns all subviews
clickViews = [clickViews filteredArrayUsingPredicate:clickedPredicate]; // On-views
But you should think about storing the state outside the views. What is your app for?
I am working on a project that has the concept of draggable controls, everything is working fine except that NSView seems to employ a fade in/out animation when calling setHidden:.
I have been able to work around the problem by changing the line session.animatesToStartingPositionsOnCancelOrFail = YES; to NO and implementing the image snapback myself with a custom animated NSWindow subclass. it looks great, but I know there must be an easier way.
I have tried:
using NSAnimationContext grouping with duration of 0 around the setHidden: calls
setting the view animations dictionary using various keys (alpha, hidden, isHidden) on the control and superview
overriding animationForKey: for both the control and its superview
I am not using CALayers and have even tried explicitly setting wantsLayer: to NO.
Does anybody know how to either disable this animation, or have a simpler solution then my animated NSWindow?
here is my stripped down altered code with the bare minimum to see what I'm talking about.
#implementation NSControl (DragControl)
- (NSDraggingSession*)beginDraggingSessionWithDraggingCell:(NSActionCell <NSDraggingSource> *)cell event:(NSEvent*) theEvent
{
NSImage* image = [self imageForCell:cell];
NSDraggingItem* di = [[NSDraggingItem alloc] initWithPasteboardWriter:image];
NSRect dragFrame = [self frameForCell:cell];
dragFrame.size = image.size;
[di setDraggingFrame:dragFrame contents:image];
NSArray* items = [NSArray arrayWithObject:di];
[self setHidden:YES];
return [self beginDraggingSessionWithItems:items event:theEvent source:cell];
}
- (NSRect)frameForCell:(NSCell*)cell
{
// override in multi-cell cubclasses!
return self.bounds;
}
- (NSImage*)imageForCell:(NSCell*)cell
{
return [self imageForCell:cell highlighted:[cell isHighlighted]];
}
- (NSImage*)imageForCell:(NSCell*)cell highlighted:(BOOL) highlight
{
// override in multicell cubclasses to just get an image of the dragged cell.
// for any single cell control we can just make sure that cell is the controls cell
if (cell == self.cell || cell == nil) { // nil signifies entire control
// basically a bitmap of the control
// NOTE: the cell is irrelevant when dealing with a single cell control
BOOL isHighlighted = [cell isHighlighted];
[cell setHighlighted:highlight];
NSRect cellFrame = [self frameForCell:cell];
// We COULD just draw the cell, to an NSImage, but button cells draw their content
// in a special way that would complicate that implementation (ex text alignment).
// subclasses that have multiple cells may wish to override this to only draw the cell
NSBitmapImageRep* rep = [self bitmapImageRepForCachingDisplayInRect:cellFrame];
NSImage* image = [[NSImage alloc] initWithSize:rep.size];
[self cacheDisplayInRect:cellFrame toBitmapImageRep:rep];
[image addRepresentation:rep];
// reset the original cell state
[cell setHighlighted:isHighlighted];
return image;
}
// cell doesnt belong to this control!
return nil;
}
#pragma mark NSDraggingDestination
- (void)draggingEnded:(id < NSDraggingInfo >)sender
{
[self setHidden:NO];
}
#end
#implementation NSActionCell (DragCell)
- (void)setControlView:(NSView *)view
{
// this is a bit of a hack, but the easiest way to make the control dragging work.
// force the control to accept image drags.
// the control will forward us the drag destination events via our DragControl category
[view registerForDraggedTypes:[NSImage imagePasteboardTypes]];
[super setControlView:view];
}
- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp
{
BOOL result = NO;
NSPoint currentPoint = theEvent.locationInWindow;
BOOL done = NO;
BOOL trackContinously = [self startTrackingAt:currentPoint inView:controlView];
BOOL mouseIsUp = NO;
NSEvent *event = nil;
while (!done)
{
NSPoint lastPoint = currentPoint;
event = [NSApp nextEventMatchingMask:(NSLeftMouseUpMask|NSLeftMouseDraggedMask)
untilDate:[NSDate distantFuture]
inMode:NSEventTrackingRunLoopMode
dequeue:YES];
if (event)
{
currentPoint = event.locationInWindow;
// Send continueTracking.../stopTracking...
if (trackContinously)
{
if (![self continueTracking:lastPoint
at:currentPoint
inView:controlView])
{
done = YES;
[self stopTracking:lastPoint
at:currentPoint
inView:controlView
mouseIsUp:mouseIsUp];
}
if (self.isContinuous)
{
[NSApp sendAction:self.action
to:self.target
from:controlView];
}
}
mouseIsUp = (event.type == NSLeftMouseUp);
done = done || mouseIsUp;
if (untilMouseUp)
{
result = mouseIsUp;
} else {
// Check if the mouse left our cell rect
result = NSPointInRect([controlView
convertPoint:currentPoint
fromView:nil], cellFrame);
if (!result)
done = YES;
}
if (done && result && ![self isContinuous])
[NSApp sendAction:self.action
to:self.target
from:controlView];
else {
done = YES;
result = YES;
// this bit-o-magic executes on either a drag event or immidiately following timer expiration
// this initiates the control drag event using NSDragging protocols
NSControl* cv = (NSControl*)self.controlView;
NSDraggingSession* session = [cv beginDraggingSessionWithDraggingCell:self
event:theEvent];
// Note that you will get an ugly flash effect when the image returns if this is set to yes
// you can work around it by setting NO and faking the release by animating an NSWindowSubclass with the image as the content
// create the window in the drag ended method for NSDragOperationNone
// there is [probably a better and easier way around this behavior by playing with view animation properties.
session.animatesToStartingPositionsOnCancelOrFail = YES;
}
}
}
return result;
}
#pragma mark - NSDraggingSource Methods
- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context
{
switch(context) {
case NSDraggingContextOutsideApplication:
return NSDragOperationNone;
break;
case NSDraggingContextWithinApplication:
default:
return NSDragOperationPrivate;
break;
}
}
- (void)draggingSession:(NSDraggingSession *)session endedAtPoint:(NSPoint)screenPoint operation:(NSDragOperation)operation
{
// now tell the control view the drag ended so it can do any cleanup it needs
// this is somewhat hackish
[self.controlView draggingEnded:nil];
}
#end
There must be a layer enabled somewhere in your view hierarchy, otherwise there wouldn't be a fade animation. Here is my way of disabling such animations:
#interface NoAnimationImageView : NSImageView
#end
#implementation NoAnimationImageView
+ (id)defaultAnimationForKey: (NSString *)key
{
return nil;
}
#end
The solution you already tried by setting the view animations dictionary should work. But not for the keys you mention but for the following. Use it somewhere before the animation is triggered the first time. If you have to do it on the window or view or both, I don't know.
NSMutableDictionary *animations = [NSMutableDictionary dictionaryWithDictionary:[[theViewOrTheWindow animator] animations];
[animations setObject:[NSNull null] forKey: NSAnimationTriggerOrderIn];
[animations setObject:[NSNull null] forKey: NSAnimationTriggerOrderOut];
[[theViewOrTheWindow animator] setAnimations:animations];
Or also just remove the keys if they are there (might not be the case as they are implicit / default):
NSMutableDictionary *animations = [NSMutableDictionary dictionaryWithDictionary:[[theViewOrTheWindow animator] animations];
[animations removeObjectForKey:NSAnimationTriggerOrderIn];
[animations removeObjectForKey:NSAnimationTriggerOrderOut];
[[theViewOrTheWindow animator] setAnimations:animations];
Ok. I figured out that the animation I'm seeing is not the control, the superview, nor the control's window. It appears that animatesToStartingPositionsOnCancelOrFail causes NSDraggingSession to create a window (observed with QuartzDebug) and put the drag image in it and it is this window that animates back to the origin and fades out before the setHidden: call is executed (i.e. before the drag operation is concluded).
Unfortunately, the window that it creates is not an NSWindow so creating a category on NSWindow doesn't disable the fade animation.
Secondly, there is no public way that I know of to get a handle on the window, so I can't attempt directly manipulating the window instance.
It looks like maybe my workaround is the best way to do this, after all its not far from what AppKit does for you anyway.
If anybody knows how to get a handle on this window, or what class it is I would be interested to know.
I'm trying to modify the appearance of a custom NSTableRowView used in my NSOutlineView when the row expands/collapses. My NSOutlineViewDelegate includes:
- (NSTableRowView *)outlineView:(NSOutlineView *)outlineView rowViewForItem:(id)item
{
...
return rowView;
}
- (void)itemDidExpand:(NSNotification *)notification
{
NSDictionary *userInfo = [notification userInfo];
id item = [userInfo objectForKey:#"NSObject"];
NSOutlineView *outlineView = [notification object];
[outlineView reloadItem:item];
}
This unfortunately doesn't reload the custom row view.
Reloading data for the entire NSOutlineView works:
- (void)itemDidExpand:(NSNotification *)notification
{
[outlineView reloadData];
}
But with large amounts of data this can be time consuming, and often leads to a spinning beach ball.
Is it possible to reload the custom row view for just a single top-level item?
Try the following method:
-(void)outlineView:(NSOutlineView *)outlineView didAddRowView:(NSTableRowView *)rowView forRow:(NSInteger)row {
aColor = [NSColor colorWithCalibratedRed:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1.0];
[view setBackgroundColor:aColor];
}
You can advance this further to get the row object, and then determine which color you want for a particular row.
-Edit-
If you wish to alter the parent cell view to show that it has been expanded you have implemented the wrong method for the NSOutlineview. Implement the method like the following:
-(void)outlineViewItemWillExpand:(NSNotification *)notification {
id theObject = [[notification userInfo] objectForKey:#"NSObject"];
NSInteger row = [theOutlineView rowForItem:theObject];
NSTableRowView *theRowView = [theOutlineView rowViewAtRow:row makeIfNecessary:NO];
int r = 110;
int g = 110;
int b = 110;
NSColor *aColor = [NSColor colorWithCalibratedRed:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1.0];
[theRowView setBackgroundColor:aColor];
}
Try this in your rowViewForItem method.
It reloads and redisplays the data for item.
- (void)reloadItem:(id)item;
I have a custom NSTableCellView with 3 textfields, 1 that came along and 2 others that i created myself. Here's the problem:
The textfields' text color stays the same even when i click on the row. I've tried to implement a code i found out by googling but it doesn't work. My Custom NSTableCellView code is:
- (void)drawRect:(NSRect)dirtyRect{
NSColor *color = [NSColor colorWithCalibratedRed:(26/255.0) green:(26/255.0) blue:(26/255.0) alpha:1.0];
[self.textField setTextColor:color];
color = [NSColor colorWithCalibratedRed:(102/255.0) green:(102/255.0) blue:(102/255.0) alpha:1.0];
[_lbl1 setTextColor:color];
[_lbl2 setTextColor:color];
}
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle {
NSColor *color = (backgroundStyle == NSBackgroundStyleDark) ? [NSColor windowBackgroundColor] : [NSColor controlShadowColor];
self.textField.textColor = color;
self.lbl1.textColor = color;
self.lbl2.textColor = color;
[super setBackgroundStyle:backgroundStyle];
}
What can i do to make the labels' text color white when the user clicks on them?
Actually, overriding setBackgroundStyle on NSTableViewCell has worked perfectly for me, at least on OS X 10.8. It is updated on selection events and on window activation/deactivation.
Here's my custom cell impl — as trivial as it can get:
#implementation RuntimeInstanceCellView
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle {
[super setBackgroundStyle:backgroundStyle];
self.detailTextField.textColor = (backgroundStyle == NSBackgroundStyleLight ? [NSColor darkGrayColor] : [NSColor colorWithCalibratedWhite:0.85 alpha:1.0]);
// self.detailTextField.textColor = (backgroundStyle == NSBackgroundStyleLight ? [NSColor blackColor] : [NSColor whiteColor]);
}
#end
Expanding on the accepted answer, in Swift 2.0 the process is slightly different. Override the backgroundStyle property of your NSTableCellView subclass to add a didSet property observer:
class CustomTableCellView: NSTableCellView {
#IBOutlet weak var detailTextField: NSTextField!
override var backgroundStyle: NSBackgroundStyle {
didSet {
if self.backgroundStyle == .Light {
self.detailTextField.textColor = NSColor.controlTextColor()
} else if self.backgroundStyle == .Dark {
self.detailTextField.textColor = NSColor.alternateSelectedControlTextColor()
}
}
}
}
And for Swift 3 & 4 (isn’t this fun?):
override var backgroundStyle: NSView.BackgroundStyle {
didSet {
if self.backgroundStyle == .light {
self.detailTextField.textColor = NSColor.controlTextColor
} else if self.backgroundStyle == .dark {
self.detailTextField.textColor = NSColor.alternateSelectedControlTextColor
}
}
}
In your tableViewSelectionDidChange get the cell using
UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath]; //replace UITableViewCell with your customCell class name if it other
//now as u got the instance of your cell u can modify the labels in it, like
cell.lable1.textColor = [UIColor whiteColor];
This will work for you.
You may get problem when you select other cell again after this, at that time previous cell may have still white colored labels. If this causes problems to you just have a NSIndexPath instance in your header class which represents previous selected indexPath, using this you can set back to default colors after selecting a new cell.