-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Styling subviews (children) #90
Comments
Let me rephrase to see if I've understood. You have some subviews that are not anchored to a particular controller, and you'd like a centralized location to style these and apply them when you place these styled subviews? Universal styles can be found in the Application stylesheet ( Would that be what you need? |
Hi, thanks for your response. My case is as follows: I have a container view, which contains a couple of views. These views are swipeable so at one time only one is visible. I have also tab bar which allows me to change view on tab click. I'd like to have these views separate from each others so that each of them implements its own stylesheet. I want to just append in my controller a subview as a class of this particular custom view without knowing about its inner structure and styles. Another example: I have a validable input ( The last one to be clear enough: In my controller I allow user to either input friend's email or choose it from contacts list. I want to build that interface by appending just two views: TL;DR |
For what it is worth. The way I have been doing this on a project of mine is creating a structure like this:
def viewDidLoad
super
rmq.stylesheet = ExampleStylesheet
end
class ExampleControllerStylesheet < ApplicationStylesheet
include SharableItemStylesheet
module SharableItemStylesheet
# shared view items
end this allows for me to create shareable objects with their own defined styles and enclosed in a stylesheet for the control. I think thats what you were asking for. The drawback is you have to include the stylesheets into the controller that is using them - etc. would be interesting in reading a different option if one exists. |
I see. I found this solution in docs too. It seems this is the only way to do that. |
As for the validatable text fields that should change styles, we've got EXACTLY that brewing for the 0.7 release. If you pull down the RMQ app, you'll see a nice example (super awesome thanks to @squidpunch for the progress he's made). Check out the code: example image attached here: I know if the style is set, and you could call "reapply_styles" this should work nicely. Maybe your subviews can have their style already set (not sure on the exact situation without code). As for now it only remembers the last style. But I know @twerth is looking at fixing styles to maintain history. |
FYI, rmq's generators will create these things for you: rmq create view example_view |
I have a view controller that contains a couple of subviews (UIView). While I can apply style for UIViewController, I'd like to have separated stylesheets for these subviews and just append these views already styled. How can I achieve that?
The problem is to decouple stylesheets from ViewController and provide them with custom views. Is there any way to do that?
The text was updated successfully, but these errors were encountered: