How to hide group title
aminiz opened this issue · comments
Is this possible?
In your style make the header transparent.
[[FORMGroupHeaderView appearance] setHeaderBackgroundColor:[UIColor clearColor]];
We have an example that does this. Check Payment Demo.
I hope this fixes your issue, otherwise feel free to reopen this issue.
Have a nice day!
Thank you! SO did not answer so I had to ask here.
I assume it is not possible to set headerView transparent just of a single group?
@annehiro It's not possible to make it transparent but you can make it the same color as your background color.
[
{
"id":"group-id",
"styles":{
"background_color":"YOUR_HEX_BACKGROUND_COLOR"
},
"sections":[
{
"id":"section-0",
"fields":[
{
"id":"email",
"title":"Email",
"type":"email",
"input_type": "email",
"size":{
"width":100,
"height":1
}
}
]
}
]
}
]
Could you share your StackOverflow question with me?
The styling relies on + (UIColor *)colorFromHex:(NSString *)hexString
provided from https://github.com/3lvis/Hex
If transparency support was added there, we could support it pretty easily in Form. I've seen that done with a fourth pair of hex values.
Example: #FF000050
for a Red background with 50% opacity.
@annehiro Hi, I was wrong, you can just send any invalid HEX value to background_color
and it will make it transparent, for example use clearcolor
.
[
{
"id":"group-id",
"styles":{
"background_color":"clearcolor"
},
"sections":[
{
"id":"section-0",
"fields":[
{
"id":"email",
"title":"Email",
"type":"email",
"input_type": "email",
"size":{
"width":100,
"height":1
}
}
]
}
]
}
]
@3lvis This is actually setting the form background color. The FORMGroupHeaderView background color is unchanged.
Follow up on this. What I would like to do is completely hide the group header in some cases. I can use [[FORMGroupHeaderView appearance] setHeaderBackgroundColor:[UIColor clearColor]]
as you suggested but this leaves me with two issues.
- In
FORMBackgroundView.m
, thedrawRect
method is drawing the corner radius as 5.0 for bottom left and bottom right corners. This leaves the top corners with corner radius 0. - The header is still there. This would be fine but now there is empty space between the navigationBar and the first form field.
If you see some value in being able to hide the group header, I can try to help with implementation.