Closed angelolloqui closed 10 years ago
The loop that actually triggers the styling is already checking for styleMode, so it shouldn't be styling if you set the mode to PXStylingNone. See https://github.com/Pixate/pixate-freestyle-ios/blob/master/src/Styling/Macros/PXStylingMacros.h#L53
Did you find this not to be the case?
Well, for example if you set a text again in a label then it is fired. I have this issue when I want to put a custom attributedString in my label for example, as PX resets the attributed text after updating. My solution is to use this hack together with a PXStylingNone.
Woow, my last commits got inserted into this pull request! Sorry for that!
And just to be clear, just setting the style mode to none doesn't do the same thing? You need the hack, right?
exactly
Can you provide some details as to why you want non-recursive updating for the controls you updated?
Im having a similar issue and needed to override -updateStyles
as a noop to get my styles to stop for a given view.
@pcolton Why would you want recursive? Setting a text/placeholder should not trigger updates on child elements right? I can imagine that the update is required in the element itself because you could have set a text-transform
property, but the childs? what can they change with a text update? maybe I am missing a css selector that depends on texts, but I can not think of any...
Even if most of these elements do not have childs, still some cpu cycles can be saved, specially in UITextViews
where it is not so strange to find childs.
@angelolloqui One of the caveats here is that our virtual controls (what we call them) are also children, but they may not be real views. For example, on UIButton, the 'icon' child is a virtual child that actually sets the image property on a UIButton, but 'icon' itself is not a view or subview in the real sense.
It still might be fine to not recursively style, but I think we'd have to test to see if it exposes any edge cases in which some virtual children don't get styled appropriately.
I updated the structure of the repo last night. Would you mind merging in the changes then resubmitting the pull request?
@angelolloqui You can see on issue #84 that not styling children now doesn't style the attributed-text
property. Other than some optimizations, can you clarify there were no other reasons NOT to be recursive? That is, I might want to revert that change.
Sometimes I want to disable styling temporary in an item. However, the styler is not checking for the property
styleMode
before starting the styling. I did not want to modify thepreventStyling
method but it could potentially be added to every UIView and return this flag by default.