I have a custom static UITableViewCell
that I want to look exactly the same as a right detail cell (UILabel
on the left, UILabel
on the right), except I want the right UILabel
to be an editable UITextField
. Since I want to use this cell in multiple view controllers in my storyboard, I decided the best option would be to create a MyEditableTableViewCell.xib file, along with corresponding *.h,m files. I have two public properties in MyEditableTableViewCell.h:
@property (weak, nonatomic) IBOutlet UILabel *textLabel;
@property (weak, nonatomic) IBOutlet UITextField *detailTextField;
These IBOutlet
s are connected to the UILabel
and UITextField
in the .xib file. In my storyboard, where I have a custom UITableViewController
subclass, I change the class of the necessary UITableViewCell
to MyEditableTableViewCell
. I have a property in my view controller that is:
@property (weak, nonatomic) IBOutlet MyEditableTableViewCell *myCell;
However, when I run the app, the cell appears as simply a blank cell. Running some checks on it, I see that [myCell isKindOfClass:[MyEditableTableViewCell class]]
returns true. However, the UITextField
never seems to get instantiated. When I try to alter myCell.detailTextField.text
, nothing happens, and myCell.detailTextField
appears to be nil.
Any help would be appreciated!