Open Emailrus opened 8 years ago
Why would you do that instead of merely doing:
/* nss file*/
MyTextField {
border-color: #123456;
}
/* some UI file */
- (void)someSetupMethod
{
self.myTextField.nuiClass = @"MyTextField";
}
By using CALayer I wanted to point out, that not everything is stylable by NUI. Some custom controls would still require manual approach. Point is, that I still need to access my styles (color palette for example) and since they are moved to .nss file and I don't want to have two files defining same styles (MyTheme.nss and MyTheme.h) it would be nice to do it via NUI.
Can this sort of thing can be addressed by render customization? It has currently been partially implemented at a very granular level, but as per the discussion it needs to be re-architected.
Partially maybe. I can think of some other scenarios, where you don't have rendering element, like if you need some padding values from .nss file to include them in layout calculations. Also accessing variables might be much easier to implement and use.
Fair enough. I'd like to hear your thoughts on this @timbodeit.
@Emailrus, while I agree feature is useful, you could you workaround, add dummy style colors you need,
App { background-color: @minor; foreground-color: @main; }
then in code use
NUISettings.getColor("background-color", withClass: "App")
@Stunner I'm sorry, I have been inactive for a little while.
I would suggest the same thing as @alexeyt820. We have "Colors" classes for various components of our app. I don't think we need new API in NUI for this. I do like the idea of a constants file however. It would be awesome to have a code-generating script, that automatically extracts constants for the different Classes and attributes to make accessing them from code safer and a little bit more convenient.
Hi again :) This time I was thinking about access to variables defined in .nss in code. Very useful in cases, where you need to obtain some global vars, so you won't be having two files with same palette, for example: