2012-09-17 79 views
1

我需要從鍵盤上刪除特定的密鑰。我查了很多,我發現如何添加自定義鍵以及如何刪除它們。但是,我需要刪除內置的密鑰。比方說,我想從鍵盤上移除一個鍵。需要從UIKeyboard中刪除密鑰

下面的代碼只是從視圖中刪除整個鍵盤,這不是我正在尋找的。

- (void)keyboardDidShow:(NSNotification *)aNotification {   
    for (UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows]) 
    { 
     // Now iterating over each subview of the available windows 
     for (UIView *keyboard in [keyboardWindow subviews]) { 
      // Check to see if the description of the view we have 
      // referenced is UIKeyboard. 
      // If so then we found the keyboard view that we were looking for. 
      if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES)      
       [[keyboard.subviews objectAtIndex:0]removeFromSuperview];     
     }    
    } 
+0

確定鍵盤窗口的子視圖我 – mkral

回答