Form icon indicating copy to clipboard operation
Form copied to clipboard

How to hide group title

Open aminiz opened this issue 10 years ago • 8 comments

Is this possible?

aminiz avatar Oct 28 '15 16:10 aminiz

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 avatar Oct 28 '15 18:10 3lvis

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?

aminiz avatar Oct 28 '15 22:10 aminiz

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

3lvis avatar Oct 28 '15 22:10 3lvis

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.

jeffleeismyhero avatar Oct 28 '15 22:10 jeffleeismyhero

http://stackoverflow.com/questions/33377387/hide-group-title-in-form-by-hyperoslo

aminiz avatar Oct 29 '15 02:10 aminiz

@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 avatar Oct 29 '15 16:10 3lvis

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

aminiz avatar Mar 10 '16 18:03 aminiz

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.

aminiz avatar Apr 13 '16 18:04 aminiz