Sto lavorando su tastiera personalizzata per iphone 6 e 6Plus. Ho sviluppato la logica per il tasto Maiusc attivo - inattivo o 123 e tasto abc. ma voglio anche mostrare un simbolo personalizzato come mostrato con la tastiera Apple. per favore controlla l'immagineTastiera personalizzata IOS. Come impostare caratteri speciali nella tastiera personalizzata
attualmente sono in grado di cambiare maiuscolo a minuscolo e 123 a abc, ma come posso impostare questo carattere speciale. NOTA: - Ho cercato una demo molto su github ma non sono in grado di vedere caratteri speciali in nessuna tastiera personalizzata.
Ecco la mia logica per maiuscolo e ABC-123 Button.
-(void)UpparCase:(UIButton*)sender // To make caps or small letter
{
sender.selected=!sender.selected;
if(sender.selected)
{
if(isPortrait)
{
[self.ObjKeyLayout.btnCapKey setBackgroundImage:[UIImage imageNamed:@"upparActive.png"] forState:UIControlStateNormal];
}
else
{
[self.ObjKeyLayout.btnCapKey setBackgroundImage:[UIImage imageNamed:@"Uppar_selctd_land.png"] forState:UIControlStateNormal];
}
for(UIButton *key in self.ObjKeyLayout.ArryCharKey)
{
NSString *uppercaseString = [[key currentTitle] uppercaseString];
[key setTitle:uppercaseString forState:UIControlStateNormal];
[key addTarget:self action:@selector(pressKey:) forControlEvents:UIControlEventTouchUpInside];
}
}
else
{
if(isPortrait)
{
[self.ObjKeyLayout.btnCapKey setBackgroundImage:[UIImage imageNamed:@"UpperCase.png"] forState:UIControlStateNormal];
}
else
{
[self.ObjKeyLayout.btnCapKey setBackgroundImage:[UIImage imageNamed:@"Uppar_land.png"] forState:UIControlStateNormal];
}
for(UIButton *key in self.ObjKeyLayout.ArryCharKey)
{
NSString *uppercaseString = [[key currentTitle] lowercaseString];
[key setTitle:uppercaseString forState:UIControlStateNormal];
[key addTarget:self action:@selector(pressKey:) forControlEvents:UIControlEventTouchUpInside];
}
}
}
- (IBAction)action123:(UIButton*)sender // To set 123 and ABC
{
sender.selected=!sender.selected;
if(sender.selected)
{
[self.ObjKeyLayout.btn123Key setTitle:@"ABC" forState:UIControlStateNormal];
int i=0;
for(UIButton *key in self.ObjKeyLayout.ArryCharKey)
{
[key setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
NSLog(@"\n\n123isSelected\nI-%i\tArrayCharKey.Count:-%i",i,(int)self.ObjKeyLayout.ArryCharKey.count);
if(isPortrait)
{
NSLog(@"\n\n123isSelected\nI-%i\tArrayCharKey.Count:-%i\nArraySpecialImageKey.Count-%i\n",i,(int)self.ObjKeyLayout.ArryCharKey.count,(int)arrspecialImageKey.count);
[key setBackgroundImage:[UIImage imageNamed:[arrspecialImageKey objectAtIndex:i]] forState:UIControlStateNormal];
}
else{
[key setBackgroundImage:[UIImage imageNamed:[arrSpecialIpad objectAtIndex:i]] forState:UIControlStateNormal];
}
[key setTitle:[NumKey objectAtIndex:i] forState:UIControlStateNormal];
[key addTarget:self action:@selector(pressKey:) forControlEvents:UIControlEventTouchUpInside];
i++;
}
}
else
{
[self.ObjKeyLayout.btn123Key setTitle:@"123" forState:UIControlStateNormal];
int i=0;
for(UIButton *key in self.ObjKeyLayout.ArryCharKey)
{
[key setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
if(isPortrait)
{
[key setBackgroundImage:[UIImage imageNamed:[arrKeyImages objectAtIndex:i]] forState:UIControlStateNormal];
}
else
{
[key setBackgroundImage:[UIImage imageNamed:[keyIpad objectAtIndex:i]] forState:UIControlStateNormal];
}
;
NSString *uppercaseString = [arrAlphabet objectAtIndex:i];
[key setTitle:uppercaseString forState:UIControlStateNormal];
[key addTarget:self action:@selector(pressKey:) forControlEvents:UIControlEventTouchUpInside];
i++;
// is123selected=NO;
}
}
}
sì, buona logica per lettere maiuscole. –