Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions FXForms/FXForms.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ UIKIT_EXTERN NSString *const FXFormFieldFooter; //footer
UIKIT_EXTERN NSString *const FXFormFieldInline; //inline
UIKIT_EXTERN NSString *const FXFormFieldSortable; //sortable
UIKIT_EXTERN NSString *const FXFormFieldViewController; //viewController
UIKIT_EXTERN NSString *const FXFormFieldXib; //Xib

UIKIT_EXTERN NSString *const FXFormFieldTypeDefault; //default
UIKIT_EXTERN NSString *const FXFormFieldTypeLabel; //label
Expand Down Expand Up @@ -118,6 +119,7 @@ UIKIT_EXTERN NSString *const FXFormFieldTypeImage; //image
@property (nonatomic, readonly) void (^action)(id sender);
@property (nonatomic, readonly) id segue;
@property (nonatomic, strong) id value;
@property (nonatomic, strong) NSString *xib;

- (NSUInteger)optionCount;
- (id)optionAtIndex:(NSUInteger)index;
Expand Down
12 changes: 12 additions & 0 deletions FXForms/FXForms.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
NSString *const FXFormFieldInline = @"inline";
NSString *const FXFormFieldSortable = @"sortable";
NSString *const FXFormFieldViewController = @"viewController";
NSString *const FXFormFieldXib = @"xib";

NSString *const FXFormFieldTypeDefault = @"default";
NSString *const FXFormFieldTypeLabel = @"label";
Expand Down Expand Up @@ -628,6 +629,11 @@ static void FXFormPreprocessFieldDictionary(NSMutableDictionary *dictionary)
dictionary[FXFormFieldTitle] = NSLocalizedString(output, nil);
}
}

//get field xib name if declared
if (dictionary[FXFormFieldXib]) {
dictionary[FXFormFieldXib]=[NSString stringWithFormat:@"%@",dictionary[FXFormFieldXib]];
}
}


Expand Down Expand Up @@ -2122,6 +2128,12 @@ - (UITableViewCell *)cellForField:(FXFormField *)field
if ([nibName rangeOfString:@"."].location != NSNotFound) {
nibName = nibName.pathExtension; //Removes Swift namespace
}

//if xib name is mentioned use same xib name to load with class
if (field.xib && field.xib.length) {
nibName = field.xib;
}

if ([[NSBundle mainBundle] pathForResource:nibName ofType:@"nib"])
{
//load cell from nib
Expand Down