Comments (6)
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 (stylesheets/application_stylesheet.rb
). It's a great spot to include any universal styles. Then when you add the views they'll have access to those styles.
Would that be what you need?
from rmq.
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 (UITextField
), e.g. email or phone number. This input should responds to changes and style itself different depending on provided input (change color, font, border). I want to append just ValidableEmailTextField
and don't bother about its inner styles.
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: ValidableEmailTextField
and FriendsListTableView
. My controller's stylesheet should only place list container under input and nothing more. Both text field and table view should come with their own styles and my controller shouldn't know about them at all.
TL;DR
I need to have reusable components extending UIView
with own styles and include them without knowing about their stylesheets.
from rmq.
For what it is worth. The way I have been doing this on a project of mine is creating a structure like this:
app/controllers/example_controller.rb
def viewDidLoad
super
rmq.stylesheet = ExampleStylesheet
end
app/stylesheets/controller_stylesheet.rb
class ExampleControllerStylesheet < ApplicationStylesheet
include SharableItemStylesheet
app/stylesheets/sharable_item_stylesheet.rb
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.
from rmq.
I see. I found this solution in docs too. It seems this is the only way to do that.
from rmq.
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.
from rmq.
FYI, rmq's generators will create these things for you:
rmq create view example_view
rmq create table_view_controller example_table
rmq create collection_view_controller example_collection
from rmq.
Related Issues (20)
- device.simulator? is broken in iOS9 SDK HOT 13
- Add support for multiple gestures of the same type with different parameters HOT 5
- if view in UITableViewCell contentView, the :full option for frame is wrong HOT 7
- constant button on top of scrollView? HOT 4
- error: not working on latest iOS 9.0.2 HOT 2
- [RMQ ERROR] on v10.11.1 HOT 5
- how to use UIAppearance with stylesheets, or otherwise default UI elements to "ios blue"? HOT 1
- If I toggle st.secure_text_entry, I cannot restore the font HOT 1
- Include childModalViewControllers when checking rmq.app.current_view_controller
- When I set navbar translucent to false grid stops working
- Documentation search does not work: Error establishing a database connection HOT 1
- How to get value of attribute? HOT 12
- Change spinner color HOT 3
- Getting iOS version error HOT 2
- Extension is not passed into resource
- rake failing when trying to open ios simulator
- Apply styles to UIButton Inner Objects
- Unable to open the documentation HOT 1
- Documentation website is down HOT 2
- repl error: rmq.all.inspector => renderInContext:' type `v@:^{CGContext=}' not precompiled
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rmq.