iOSTable Highlight Color

Is there a declare that anyone knows of that can be used to change the default highlight color of an iOSTable?

This appears to be the relevant documentation from the UIKit API, but I’m not savvy enough with declares to put it all together and access the selectionStyle property of the table cell.

I am using a table populated with iOSCustomTableCell objects.

Thanks for any help.

Simple answer you can’t change the highlight color.

Long answer, starting with iOS 7 there are only two options:
-the default gray hightlight color
-No highlight color

The following declare will remove the highlight when tapping a row.

declare sub setselectionStyle lib "UIKit.framework" selector "setSelectionStyle:" (obj_id as ptr, style as Integer) setselectionStyle(cell.Handle, 0)

Thanks for the reply Jrmie, that’s good information to know.

I think that I will approach this with a canvas as the background of the cell which I can draw into similar to desktop Xojo’s CellBackgroundPaint. I’ll save the index of the row that was selected, make the background canvas visible in the RowData method of the DataSource, and then call ReloadData on the table.

As far as I can tell, this is the best solution.

Thanks again for the clarification.

What about http://developer.xojo.com/iostablecelldata$Image

You can draw into the image as well. No need to add a canvas.

I gave that method a try as well, just to get some more iOS experience, but it appears that iOSTableCellData.Image draws on top the controls in the cell.

I guess you mean the “SelectionColor” of a Table-Cell - the colors that appears when the user taps on a cell?

In Objective C, in a subclass of UITableViewCell, you can achieve this like that:

UIView *selectionBGView = [[UIView alloc] init]; selectionBGView.backgroundColor = [UIColor ...whatever-color-you-wish...]; self.selectedBackgroundView = selectionBGView;

API Reference: UIKit - UITableViewCell - selectedBackgroundView

[quote]Instance Property: selected?Background?View
The view used as the background of the cell when it is selected.[/quote]
I can’t give you a Xojo-Declare (but I hope others here can), but it sure seems to be possible.

I ran across this looking to do the same for the selected cell and then found a solution in other threads

You need to add this from https://github.com/jkleroy/iOSDesignExtensions

I use a global Public Property highlight_color as Color = &cFFFE0A00 and set that to a color for highlight
change &cFFFF660 to whatever color you need

Then in the Open Event of an IOSTable add this

Dim cellData As iOSTableCellData cellData.SetSelectedBackgroundColorXC(highlight_color)

I am using Luna and use this in the returned data in PageReceived for a tables data needs. In that case I do not add to Open Event I add this in PageReceived
In this example I have a custom cell for each row
Full_Name_Table is the name of an iOSTable
PersonNameAddressCustomCell is iOSCustomTableCell with two iOSLabel and one iOSImageView

Then in PageReturn for this specific LUNA response I add this
Dim cellData As iOSTableCellData = Full_Name_Table.CreateCustomCell(GetTypeInfo(PersonNameAddressCustomCell))

Then this
cellData.SetSelectedBackgroundColorXC(highlight_color)
to set the highlight color