How do I separate two text fields in a table view controller in iOS using Objective-C?

I want to separate two text fields in a table view controller. I want to add a drop down before one text field, but if I am adding a drop down for that text field it is automatically adding for both text fields. Please can you let me know how to separate those text fields and add a drop down for the same?
Below code for editing the text fields:
#import "IconEditableCell.h"


@interface IconEditableCell () <UITextFieldDelegate>


@property (nonatomic, strong) UIImage *icon;

@property (nonatomic, strong) UIImage *selectedIcon;


@end


@implementation IconEditableCell

  • (instancetype)cellWithPlaceholderText:(NSString *)placeholder

Code Block
icon:(NSString *)icon

selectedIcon:(NSString *)selectedIcon
Code Block
delegate:(id<IconEditableCellDelegate>)delegate {

NSArray *views =
Code Block
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil];

IconEditableCell *cell = [views firstObject];
Code Block
[cell setupWithPlaceholderText:placeholder icon:icon selectedIcon:selectedIcon delegate:delegate];
Code Block
return cell;

}

  • (void)setupWithPlaceholderText:(NSString *)placeholder

Code Block
icon:(NSString *)icon

selectedIcon:(NSString *)selectedIcon
Code Block
delegate:(id<IconEditableCellDelegate>)delegate {

self.icon = [UIImage imageNamed:icon];
Code Block
self.selectedIcon = [UIImage imageNamed:selectedIcon];
Code Block
self.iconImageView.image = self.icon;

self.textField.placeholder = placeholder;
Code Block
self.textField.delegate = self;

self.delegate = delegate;
Code Block

}


#pragma mark - UITextFieldDelegate

  • (void)textFieldDidBeginEditing:(UITextField *)textField {

Code Block
self.iconImageView.image = self.selectedIcon;

if ([self.delegate respondsToSelector:@selector(editableCellDidBeginEditing:)]) {
Code Block
[self.delegate editableCellDidBeginEditing:self];

}

}

  • (void)textFieldDidEndEditing:(UITextField *)textField {

Code Block
self.iconImageView.image = self.icon;

if ([self.delegate respondsToSelector:@selector(editableCellDidEndEditing:)]) {
Code Block
[self.delegate editableCellDidEndEditing:self];

}

}

  • (BOOL)textFieldShouldReturn:(UITextField *)textField {

Code Block
if ([self.delegate respondsToSelector:@selector(editableCellShouldReturn:)]) {

return [self.delegate editableCellShouldReturn:self];
Code Block
} else {

return YES;
Code Block
}

}


@end
Please find below code where we are trying to add the code in UITableViewController class:
  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

Code Block
UITableViewCell *cell;

Code Block
if (indexPath.row < self.editableCells.count) {

cell = self.editableCells[indexPath.row];
Code Block
} else {

cell = self.buttonCells[indexPath.row - self.editableCells.count];
Code Block
}

User *user = [User currentUser];
Code Block
self.selectedVehicle = [user.assistant vehicle];

if (cell == self.vehicleCell) {
Code Block
if ([user.assistant vehicle] != nil) {

Vehicle *v = [user.assistant vehicle];
Code Block
NSString *vehicle = [NSString stringWithFormat:@"%@ (%@)", v.vehicleTypeDescription, v.registrationNumber ];

if (v.registrationNumber == nil) {
Code Block
vehicle = v.vehicleTypeDescription;

} else
Code Block
if (v.vehicleTypeDescription == nil) {

vehicle = v.registrationNumber;
Code Block
}

self.vehicleCell.titleLabel.text = vehicle;
Code Block
} else {

[self.vehicleCell titleLabel].text = @"";
Code Block
}

} else
Code Block
if (cell == self.phoneCell) {

[self.phoneCell textField].text = [user.assistant phoneNumber];
Code Block
} else

if (cell == self.mailCell) {
Code Block
[self.mailCell textField].text = [user.assistant email];

}
Code Block
return cell;

}
Can you please suggest me what can I do for this, where I want to separate two text fields and want to add a dropdown before one text field?

Your post is absolutely nightmare to read.

Please format correctly the code with the code formatter.
How do I separate two text fields in a table view controller in iOS using Objective-C?
 
 
Q