2012-10-03 212 views
0

我們如何在默認鍵盤中添加具有如下圖所示界面的自定義按鈕。如何自定義鍵盤

enter image description here

我怎麼可以這樣做?

謝謝。

+0

自定義鍵盤是一個很難的部分,因爲蘋果沒有提供太多的工作。我會建議一個黑客,每當需要顯示一個鍵盤顯示按鈕通過管理鍵盤通知的自定義視圖。並以編程方式隱藏原始的。我不知道這是可以接受的appstore.Have第一次也檢查 –

回答

0

它非常簡單隻需創建一個的viewController用的.xib並獲得上述的畫面截圖。修復UIImageView的屏幕截圖然後你需要放置自定義的UIButtons並設置標籤屬性與按鈕意圖相同1,2,3然後創建一個方法分配給所有UIButtons並使用它們的標籤屬性執行操作。

如果你想在UITextField中輸入一些文本,那麼你需要實現UITextFiled textShouldBeginEditing的委託方法返回no。你有什麼想法?

-1

通過定製它們,您可以將簡單的按鈕添加到UIKeyBoard

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


// create custom button 
UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
doneButton.frame = CGRectMake(215, 163, 106, 53); 
doneButton.adjustsImageWhenHighlighted = NO; 
[doneButton setImage:[UIImage imageNamed:@"DoneUp.png"] forState:UIControlStateNormal]; 
[doneButton setImage:[UIImage imageNamed:@"DoneDown.png"] forState:UIControlStateHighlighted]; 
[doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside]; 

UIWindow* tempWindow; 

UIView* keyboard; 

for(int c = 0; c < [[[UIApplication sharedApplication] windows] count]; C++) 
{ 
    tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:c]; 

    for(int i = 0; i < [tempWindow.subviews count]; i++) 
    { 
     keyboard = [tempWindow.subviews objectAtIndex:i]; 

     if([[keyboard description] hasPrefix:@"<UIPeripheralHostView"] == YES) 
     { 
      [keyboard addSubview:doneButton]; 
     } 
    } 
} 
} 

或檢查出此鏈接,自定義鍵盤佈局

BSKeyboardControls

0

我想你可以提供一個UIView更換鍵盤......我從來沒有使用但此功能。