Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

How to hide group title #482

Open
aminiz opened this issue Oct 28, 2015 · 8 comments
Open

How to hide group title #482

aminiz opened this issue Oct 28, 2015 · 8 comments

Comments

@aminiz
Copy link
Contributor

aminiz commented Oct 28, 2015

Is this possible?

@3lvis
Copy link
Owner

3lvis commented Oct 28, 2015

In your style make the header transparent.

[[FORMGroupHeaderView appearance] setHeaderBackgroundColor:[UIColor clearColor]];

We have an example that does this. Check Payment Demo.

simulator screen shot 28 oct 2015 19 12 11

I hope this fixes your issue, otherwise feel free to reopen this issue.

Have a nice day!

@3lvis 3lvis closed this as completed Oct 28, 2015
@aminiz
Copy link
Contributor Author

aminiz commented Oct 28, 2015

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?

@3lvis
Copy link
Owner

3lvis commented Oct 28, 2015

@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?

@jeffleeismyhero
Copy link
Collaborator

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.

@aminiz
Copy link
Contributor Author

aminiz commented Oct 29, 2015

@3lvis
Copy link
Owner

3lvis commented Oct 29, 2015

@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
            }
          }
        ]
      }
    ]
  }
]

@aminiz
Copy link
Contributor Author

aminiz commented Mar 10, 2016

@3lvis This is actually setting the form background color. The FORMGroupHeaderView background color is unchanged.

@aminiz
Copy link
Contributor Author

aminiz commented Apr 13, 2016

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.

  1. In FORMBackgroundView.m, the drawRect 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.
  2. 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.

@3lvis 3lvis reopened this Apr 13, 2016
@3lvis 3lvis self-assigned this May 3, 2016
@3lvis 3lvis removed their assignment Jan 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants