The AnimatedFormFieldTableViewCell
allows you to implement a UITableViewCell
with an embedded UITextField
that automatically scales the textfield's placeholder upon user interaction.
Installation: Grab the "AnimatedFormFieldTableViewCell.xib" and "AnimatedFormFieldTableViewCell.swift" files from the "AnimatedFormFieldTableViewCell" folder and drag them to your project".
In order to use AnimatedFormFieldTableViewCell
, all you have to do is:
-
Register the
AnimatedFormFieldTableViewCell
nib on the ViewController on which you are implementing your UITableView for your reuse identifier. -
Dequeue your cell on
CellForRowAtIndexPath
as aAnimatedFormFieldTableViewCell
. -
Change the placeholder's label text by calling
setLabelText
on the cell itself.
And you're pretty much done :). Everything should take care of itself from this point forward.
Notes:
-
In order to access the embedded
UITextField
you can simply call the cell'scellTextField
property. -
The
AnimatedFormFieldTableViewCell
conforms to theUITextFieldDelegate
protocol, so if you wish to implement any of theUITextFieldDelegate
for the cell's textField, you just need to set thedelegate
on the cell itself (and not on the textField - there's no need for that - the cell will take care of that). -
For best results - cell height should be 60.