Creating a custom UIKeyBoard for iPhone

后端 未结 2 660
小鲜肉
小鲜肉 2020-12-03 02:37

If anyone has the app GymBuddy, then they will know what I am talking about. They seem to use the stock Number Pad keyboard but have added a \".\" button in the lower left a

2条回答
  •  无人及你
    2020-12-03 03:04

    I have done this. Basically you add your own button as a subview of the UIKeyboard like this:

    // This function is called each time the keyboard is going to be shown
    - (void)keyboardWillShow:(NSNotification *)note {
    
    // Just used to reference windows of our application while we iterate though them
    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];
    
        // Loop through all views in the current window
        for(int i = 0; i < [tempWindow.subviews count]; i++)
        {
            // Get a reference to the current view
            keyboard = [tempWindow.subviews objectAtIndex:i];
    
            // From all the apps i have made, they keyboard view description always starts with 

    Hope that's clear.

    -Oscar

提交回复
热议问题