project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m
changeset 8441 a00b0fa0dbd7
parent 8426 4b66e60c9967
child 10108 c68cf030eded
equal deleted inserted replaced
8440:ea4d6a7a2937 8441:a00b0fa0dbd7
   147                 editableCell.minimumCharacters = 0;
   147                 editableCell.minimumCharacters = 0;
   148                 editableCell.delegate = self;
   148                 editableCell.delegate = self;
   149                 editableCell.textField.font = [UIFont systemFontOfSize:[UIFont systemFontSize]];
   149                 editableCell.textField.font = [UIFont systemFontOfSize:[UIFont systemFontSize]];
   150                 editableCell.textField.textColor = [UIColor blackColor];
   150                 editableCell.textField.textColor = [UIColor blackColor];
   151             }
   151             }
   152             
   152 
   153             if (row == 0) {
   153             if (row == 0) {
   154                 editableCell.titleLabel.text = NSLocalizedString(@"Nickname","from the settings table");
   154                 editableCell.titleLabel.text = NSLocalizedString(@"Nickname","from the settings table");
   155                 editableCell.textField.placeholder = NSLocalizedString(@"Insert your username (if you have one)",@"from the settings table");
   155                 editableCell.textField.placeholder = NSLocalizedString(@"Insert your username (if you have one)",@"from the settings table");
   156                 editableCell.textField.text = [settings objectForKey:@"username"];
   156                 editableCell.textField.text = [settings objectForKey:@"username"];
   157                 editableCell.textField.secureTextEntry = NO;
   157                 editableCell.textField.secureTextEntry = NO;
   161                 editableCell.textField.placeholder = NSLocalizedString(@"Insert your password",@"from the settings table");
   161                 editableCell.textField.placeholder = NSLocalizedString(@"Insert your password",@"from the settings table");
   162                 editableCell.textField.text = [settings objectForKey:@"password"];
   162                 editableCell.textField.text = [settings objectForKey:@"password"];
   163                 editableCell.textField.secureTextEntry = YES;
   163                 editableCell.textField.secureTextEntry = YES;
   164                 editableCell.tag = 50;
   164                 editableCell.tag = 50;
   165             }
   165             }
   166             
   166 
   167             editableCell.accessoryView = nil;
   167             editableCell.accessoryView = nil;
   168             cell = editableCell;
   168             cell = editableCell;
   169             break;
   169             break;
   170         case 1:
   170         case 1:
   171             cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier1];
   171             cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier1];
   174                 UISwitch *theSwitch = [[UISwitch alloc] init];
   174                 UISwitch *theSwitch = [[UISwitch alloc] init];
   175                 [theSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
   175                 [theSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
   176                 cell.accessoryView = theSwitch;
   176                 cell.accessoryView = theSwitch;
   177                 [theSwitch release];
   177                 [theSwitch release];
   178             }
   178             }
   179             
   179 
   180             switchContent = (UISwitch *)cell.accessoryView;
   180             switchContent = (UISwitch *)cell.accessoryView;
   181             if (row == 0) {
   181             if (row == 0) {
   182                 cell.textLabel.text = NSLocalizedString(@"Sound Effects", @"from the settings table");
   182                 cell.textLabel.text = NSLocalizedString(@"Sound Effects", @"from the settings table");
   183                 switchContent.on = [[settings objectForKey:@"sound"] boolValue];
   183                 switchContent.on = [[settings objectForKey:@"sound"] boolValue];
   184                 switchContent.tag = 10;
   184                 switchContent.tag = 10;
   195                 UISwitch *theSwitch = [[UISwitch alloc] init];
   195                 UISwitch *theSwitch = [[UISwitch alloc] init];
   196                 [theSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
   196                 [theSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
   197                 cell.accessoryView = theSwitch;
   197                 cell.accessoryView = theSwitch;
   198                 [theSwitch release];
   198                 [theSwitch release];
   199             }
   199             }
   200             
   200 
   201             switchContent = (UISwitch *)cell.accessoryView;
   201             switchContent = (UISwitch *)cell.accessoryView;
   202             cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
   202             cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
   203             switch (row) {
   203             switch (row) {
   204                 case 0:
   204                 case 0:
   205                     cell.textLabel.text = NSLocalizedString(@"Alternate Damage", @"from the settings table");
   205                     cell.textLabel.text = NSLocalizedString(@"Alternate Damage", @"from the settings table");
   219             }
   219             }
   220             break;
   220             break;
   221         default:
   221         default:
   222             break;
   222             break;
   223     }
   223     }
   224     
   224 
   225     cell.accessoryType = UITableViewCellAccessoryNone;
   225     cell.accessoryType = UITableViewCellAccessoryNone;
   226     cell.selectionStyle = UITableViewCellSelectionStyleNone;
   226     cell.selectionStyle = UITableViewCellSelectionStyleNone;
   227     cell.imageView.image = nil;
   227     cell.imageView.image = nil;
   228 
   228 
   229     return cell;
   229     return cell;