Comments (10)
Consider it on our todo list :-)
from form.
👍
from form.
from form.
We have
typedef void (^HYPFieldConfigureCellBlock)(id cell, NSIndexPath *indexPath, HYPFormField *field);
It's a configuration block that gets called when the cells get called for usage (reusage), if it's not implemented it only does this.
The idea is that you in this configuration block can change the color of the cell background, cell title label and so on.
You can do the same thing with the headerConfigurationBlock
.
This might be an overkill since styling should be applied only on initialization.
Other idea could be providing a "THEMEPROVIDER"
Yeah.
from form.
@NSElvis I was more thinking about HYPFormBackgroundView which is not possible to style for now.
But anyways, ThemeProvider/ThemeStyler would be the best solution as it could style propper views/cells only when those are instantiated.
from form.
@andrewgubanov maybe considering UIAppearance
is a good idea too
from form.
@NSElvis depends on how much you want to allow user to customize your interface. UIAppearance is good for "coloring" already styled UI. But if you want your users to be able to actually style the UI, then you need smth like ThemeProvier, etc. It is like if I want to have my backgroundview in a shape of a peer for example. In this case UIAppearance won't help much :)
from form.
I tried UIAppearance with FORMTextField
, works pretty good.
[[FORMTextField appearance] setTextColor:[UIColor redColor]];
[[FORMTextField appearance] setBackgroundColor:[UIColor yellowColor]];
There are two caveats, the first one is that we need to avoid setting the colors the way we've been doing it, otherwise UIAppearance doesn't work.
The second one is that I haven't figured out how to style a CALayer using UIAppearance, this is important if we want to give access to thinks like border color, or corner radius.
from form.
There are two caveats, the first one is that we need to avoid setting the colors the way we've been doing it, otherwise UIAppearance doesn't work.
This is expected behaviour of the way UIAppearane works. You can read more info here.
There is also no way to style CALayer as it does not conform to UIAppearance. For this reason I have implemented my own DMAppearance you can check out. Then in your custom CALayer you conform to UIAppearance protocol and in +[MYCALayer appearance] return DMAppearanceRecord instance.
Another option is to not give access to underlying CALayer of your UIView. You simply declare properties cornerRadius, borderColor, etc with UI_APPEARANCE_SELECTOR in your UIView subclass, and in setters set those values into self.layer.
Keep in mind that if you want to provide default styling via UIAppearance flow in your custom views, you should do this in +load or +initialize methods depends on how much you do not care about the memory footpring of your app :) I personally do this in +initialize
from form.
You simply declare properties cornerRadius, borderColor, etc with UI_APPEARANCE_SELECTOR in your UIView subclass, and in setters set those values into self.layer.
@andrewgubanov I was looking into this approach and I like it a lot! :)
from form.
Related Issues (20)
- Feature Request: Consider adding standard UITextView field type HOT 1
- Feature Proposal: Show validation error message beside form field title HOT 9
- Feature Request: Allow custom input validator HOT 8
- How does one subscribe a custom cell's FORMBaseFieldDelegate to the conforming class FORMDataSource? HOT 1
- Use case difference between Sections and Fields HOT 5
- Dynamic Buttons HOT 3
- [Question] How does your GroupHeaders keep track of their collapsed state upon dequeue? HOT 8
- How to create form templates which creates JSON? HOT 11
- Do the Form support multiple checkboxes? HOT 5
- Add tests for Hidden field order #571
- How do I choose id for each element? HOT 1
- NSInternalInconsistency exception when attempting to process FORMTarget HOT 1
- Swift Syntax Error HOT 1
- FORMFieldValuesTableViewController navigation bar title color change
- Segment get unselected when combined with Show target HOT 2
- Show/Hide group HOT 7
- Memory leaks in demo project (and so in projects using the lib)
- Potential memory leaks in Model layer
- View transition bug when keyboard show, only in iOS 11 HOT 7
- Multiselect support HOT 5
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 form.