Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with customization #557

Closed
hdoria opened this issue Jul 12, 2016 · 11 comments
Closed

Help with customization #557

hdoria opened this issue Jul 12, 2016 · 11 comments

Comments

@hdoria
Copy link

hdoria commented Jul 12, 2016

Hi,

I'm having some troubles to customize my form. Is there a way to customize Eureka to have all the TextRows to be something like this:

artboard_1

I need to:

  • Change the left and right margins
  • Add border to all fields
  • Add space between the fields

Thanks.

@mats-claassen
Copy link
Member

Yes you can use the following: defaultCellUpdate, defaultCellSetup and/or defaultRowInitializer on each row type to get that

@mats-claassen
Copy link
Member

@hdoria Could you create rows with that style?

@hdoria
Copy link
Author

hdoria commented Aug 29, 2016

@mats-claassen not yet. I have tried with defaultCellSetup, but it didn't work. I'm having problems with the left and right margins. :(

@mats-claassen
Copy link
Member

One solution would be to subclass FieldCell and change its constraints by overriding customConstraints. Then you would have to create a subclass of that for every type of row you want to use, which is a bit of a downside but not more than like 100 lines of pretty repetitive code.

Another solution is changing layoutMargins of the cells. This is sometimes troublesome but I am sure you can get it done with that.

@adrianod1as
Copy link

adrianod1as commented Sep 6, 2016

form

I was able to reproduce the model. I subclassed the FieldCell class and overrode the method customConstraints as @mats-claassen suggested (thanks for that). I set the separatorStyle for none, changed the visual language part to get the correct margins, set a board around the textflied and some padding using a UIView for text inside of it. For the button I can add an UIButton as subview or use only the cell's textlabel. However, we still need to limit the area of the "click". I assume it's need some coding to change the methods to use only the textfields/subviews/textlabels instead of the whole cell, and perhaps it's not the best approach, so I'd love to hear some suggestions.

Thanks in Advance!!

@mats-claassen
Copy link
Member

For the button I would use a footer on the section with a real UIButton so that the user gets the correct button tap animation. That also solves your "tappable area issue".

@codajustin
Copy link

Hi
Any chance you can provide an example how to properly subclass FieldCell to perform this type of customization? Currently using 2.0.0-beta.1.

Thank you

@poonamdhomane
Copy link

poonamdhomane commented Mar 8, 2017

I have simple solution , Just change the tableview frame as below

self.tableView?.frame = CGRect(x: 20, y: (self.tableView?.frame.origin.y)!, width: (self.tableView?.frame.size.width)!-40, height: (self.tableView?.frame.size.height)!)

and in .setupcell set cell.layer.borderColor and borderWidth

@marciomeschini
Copy link

cell.contentView.layoutMargins = whateverInsets

@liorp
Copy link

liorp commented Dec 15, 2017

Changing layoutMargins code example:
After defining form, add
for row in form.rows { row.baseCell.separatorInset = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20) }

@Coners
Copy link

Coners commented Apr 17, 2019

MESSAGE TO ALL:

These answers only work if you have done other things I fixed this issue (from start to finish) by doing this I don't want to repost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants