Hello,
I’m starting over again with a problem that I had solved in ASOC, but this time in Objective-C.
I have a matrix of customized cells, which have to retain a single information: their background color. A former version was suggested to me by rdelmar: the coding of the color was added to the customized cell and saved to a file (as background color is usually NOT saved).
My new version does this differently: the coding is not necessary, because the color information is retained as a color reference, an integer value stored conveniently into the tag of the cell.
So far, so good: the color reference allows the changing of the color: the color picker changes the color, but not the reference, so the color of the cell can be updated any time.
In my app, I made possible for the user to create, via a controller, any possible number of colors. I have still to implement what happens to cells when a color is deleted, but I can do this later.
My problem is, as the table color can change, be shortened or expanded, as every individual color may change, the only fixed reference is the controller itself. So I decided to put a reference to it into a class variable, like this:
The initialization of the cell is straightforward, I just want a new cell to be white, no border and so on. And I put the reference into the class variable:
Now. for the drawing itself. This is laborious! Each cell must look into the controller to retrieve the color reference and sets its background accordingly. Once again, the code is working but. imagine this: they are 4096 cells! Even with the best processor, this takes too much time:
The color records has the “colorRef” key for the color reference and the “mapColor” key for the color itself. My design seems correct, but the implementation is not responsive enough. Do you have suggestions to speed up the drawing process? Maybe a “pure C array” for the color table, updated only when a color is changed?
Regards,