我正在使用XLForm与XLFormRowDescriptor.其他一切工作正常,但我有一个要求,我想使用自定义行与图像和文本.另外我需要在XLFormRowDescriptor动作上做XLFormRowDescriptorTypeSelectorPush.
解决方法
XLFormBaseCell的子类(如果您更喜欢使用IB,也可以创建自定义xib),并实现
+ (void)load { XLFormViewController.cellClassesForRowDescriptorTypes[@"YOUR_UNIQ_TYPE"] = NSStringFromClass([CHILD_OF_XLFormBaseCell class]); } - (void)configure { [super configure]; } - (void)update { [super update]; } + (CGFloat)formDescriptorCellHeightForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor;
要不使用默认操作(如XLFormRowDescriptorTypeSelectorPush),您可以覆盖此方法:
- (void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller { //anything you want,for example if (self.rowDescriptor.action.formBlock) { self.rowDescriptor.action.formBlock(self.rowDescriptor); } }
然后,您将能够使用创建XLFormRowDescriptor
- (instancetype)initWithTag:(NSString *)tag rowType:(NSString *)rowType title:(NSString *)title;