2012-01-16 3 views
5

J'essaie de trouver un moyen de mettre en évidence le bouton de retour sur le clavier ios standard, mais je ne trouve aucune documentation.mettre en surbrillance le bouton «retour» sur le clavier iOS

Est-ce que quelqu'un sait comment faire cela?

Merci beaucoup pour vos réponses.

+0

La prochaine fois, avant de poster, rappelez-vous que les signatures ne sont pas autorisés, selon la FAQ , et s'il vous plaît vérifier votre poste pour les fautes d'orthographe et de grammaire. –

+0

ok, merci, je ne savais pas que ... – reinvdo

+0

la documentation officielle de la pomme montre le bouton 'Go' mis en évidence (http://developer.apple.com/library/IOs/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/ KeyboardManagement.html # // apple_ref/doc/uid/TP40009542-CH5-SW3). comment cela est-il fait? – reinvdo

Répondre

4

Le bouton de retour ne peut pas être mis en évidence, l'état mis en évidence existe pour différentes valeurs de UIReturnKeyType:

typedef enum { 
    UIReturnKeyDefault, 
    UIReturnKeyGo, 
    UIReturnKeyGoogle, 
    UIReturnKeyJoin, 
    UIReturnKeyNext, 
    UIReturnKeyRoute, 
    UIReturnKeySearch, 
    UIReturnKeySend, 
    UIReturnKeyYahoo, 
    UIReturnKeyDone, 
    UIReturnKeyEmergencyCall, 
} UIReturnKeyType; 

Le bleu apparaît sur tous ces sauf pour UIReturnKeyDefault (ce qui est d'ailleurs celui qui dit « Retour »).

Vous pouvez régler le UIReturnKeyType sur toute commande d'entrée de texte qui est conforme à UITextInputTraits (par exemple UITextField, UITextView) [id <UITextInputTraits> returnKeyType].

0

Si vous voulez personnaliser votre texteAfficher un peu plus, j'ai trouvé un exemple sur how to add a custom button to the keyboard. Ce code est daté Mars 2008 et je ne pouvais pas le faire fonctionner sur iOS5, mais vous pouvez avoir l'idée:

@synthesize window; 
@synthesize viewController; 

- (void)applicationDidFinishLaunching:(UIApplication *)application {  

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; 
    window.backgroundColor = [UIColor blackColor]; 
    [window addSubview:viewController.view]; 
    [window makeKeyAndVisible]; 
} 

- (void)keyboardWillShow:(NSNotification *)note { 

    //The UIWindow that contains the keyboard view 
    UIWindow* tempWindow; 

    //Because we cant get access to the UIKeyboard throught the SDK we will just use UIView. 
    //UIKeyboard is a subclass of UIView anyways 
    UIView* keyboard; 

    //Check each window in our application 
    for(int c = 0; c < [[[UIApplication sharedApplication] windows] count]; C++) 
    { 
     //Get a reference of the current window 
     tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:c]; 

     //Get a reference of the current view 
     for(int i = 0; i < [tempWindow.subviews count]; i++) 
     { 
      keyboard = [tempWindow.subviews objectAtIndex:i]; 

      if([[keyboard description] hasPrefix:@"(lessThen)UIKeyboard"] == YES) 
      { 
       //Keyboard is now a UIView reference to the UIKeyboard we want. From here we can add a subview 
       //to th keyboard like a new button 
       dot = [UIButton buttonWithType:UIButtonTypeCustom]; 
       dot.frame = CGRectMake(0, 163, 106, 53); 
       [dot setImage:[UIImage imageNamed:@"period.gif"] forState:UIControlStateNormal]; 
       [dot setImage:[UIImage imageNamed:@"period2.gif"] forState:UIControlStateHighlighted]; 
       [keyboard addSubview:dot]; 
       [dot addTarget:self action:@selector(addDot:) forControlEvents:UIControlEventTouchUpInside]; 

       return; 
      } 
     } 
    } 
} 
Questions connexes