Skip to content

Commit

Permalink
Fix keyboard target in +detailTextFieldWithText:
Browse files Browse the repository at this point in the history
  • Loading branch information
saagarjha committed Apr 24, 2023
1 parent 1c494cd commit c26590b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/ThemeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ @implementation ThemeViewController {
BOOL _duplicated;
}

+ (UITextField *)detailTextFieldWithText:(NSString *)text monospaced:(BOOL)monospaced {
- (UITextField *)detailTextFieldWithText:(NSString *)text monospaced:(BOOL)monospaced {
UITextField *textField = [UITextField new];
textField.tag = 1;
[textField addTarget:self action:@selector(textFieldChanged:) forControlEvents:UIControlEventEditingChanged];
Expand All @@ -67,19 +67,19 @@ - (void)viewDidLoad {

self.navigationItem.title = self.theme.name;

_nameTextField = [self.class detailTextFieldWithText:_theme.name monospaced: NO];
_nameTextField = [self detailTextFieldWithText:_theme.name monospaced: NO];
_singlePaletteSwitch = [UISwitch new];
_singlePaletteSwitch.on = self.theme.lightPalette == self.theme.darkPalette;
[_singlePaletteSwitch addTarget:self action:@selector(singlePaletteChanged:) forControlEvents:UIControlEventValueChanged];

for (int i = 0; i < sizeof(_paletteTextFields) / sizeof(*_paletteTextFields); ++i) {
Palette *palette = i ? self.theme.darkPalette : self.theme.lightPalette;
_paletteTextFields[i].foregroundTextField = [self.class detailTextFieldWithText:palette.foregroundColor monospaced:YES];
_paletteTextFields[i].backgroundTextField = [self.class detailTextFieldWithText:palette.backgroundColor monospaced:YES];
_paletteTextFields[i].cursorTextField = [self.class detailTextFieldWithText:palette.cursorColor monospaced:YES];
_paletteTextFields[i].foregroundTextField = [self detailTextFieldWithText:palette.foregroundColor monospaced:YES];
_paletteTextFields[i].backgroundTextField = [self detailTextFieldWithText:palette.backgroundColor monospaced:YES];
_paletteTextFields[i].cursorTextField = [self detailTextFieldWithText:palette.cursorColor monospaced:YES];
NSMutableArray<UITextField *> *textFields = [NSMutableArray new];
for (int j = 0; j < COLORS; ++j) {
UITextField *textField = [self.class detailTextFieldWithText:palette.colorPaletteOverrides ? palette.colorPaletteOverrides[j] : nil monospaced: YES];
UITextField *textField = [self detailTextFieldWithText:palette.colorPaletteOverrides ? palette.colorPaletteOverrides[j] : nil monospaced: YES];
textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
[textFields addObject:textField];
Expand Down

0 comments on commit c26590b

Please sign in to comment.