Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14544

iOS: keyboardFrameChanged before keyboard is shown

    Details

    • Story Points:
      8
    • Sprint:
      2015 Sprint 04 SDK

      Description

      keyboardFrameChanged event doesn't do much good as it is fired after the keyboard has already been displayed. to create responsive layouts with different keyboard sizes we need to know keyboard size BEFORE the keyboard is displayed.

      iphone/Classes/AppModule.m line 386-407 could be changed to something like this

      -(void)startup
      {
      	WARN_IF_BACKGROUND_THREAD_OBJ;	//NSNotificationCenter is not threadsafe!
          NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
          [nc addObserver:self selector:@selector(willShutdown:) name:kTiWillShutdownNotification object:nil];
          [nc addObserver:self selector:@selector(willShutdownContext:) name:kTiContextShutdownNotification object:nil];
       
       
      #if __IPHONE_OS_VERSION_MIN_ALLOWED >= __IPHONE_5_0
          if ([TiUtils isIOS5OrGreater])
          {
              [nc addObserver:self selector:@selector(keyboardFrameChanged:) name:UIKeyboardWillChangeFrameNotification object:nil];
          }
      #else
          
          [nc addObserver:self selector:@selector(keyboardFrameChanged:) name:UIKeyboardWillShowNotification object:nil];
          [nc addObserver:self selector:@selector(keyboardFrameChanged:) name:UIKeyboardWillHideNotification object:nil];
          [nc addObserver:self selector:@selector(timeChanged:) name:UIApplicationSignificantTimeChangeNotification object:nil];
      #endif	
          
          [super startup];
      }
      

      Either that or provide access to both Will and Did.

      e.x.

      Ti.App.addEventListener('keyboardFrameChanged', function(e){
      	var val = Ti.Platform.displayCaps.platformHeight - e.keyboardFrame.y;
      	$.container.animate({bottom:val, duration:300}, function() {
              Ti.API.log("handleAnimateEnd");
          });
      });
      

        Attachments

          Activity

            People

            • Assignee:
              vduggal Vishal Duggal (Inactive)
              Reporter:
              troscoe Tristan Roscoe
              Reviewer:
              Pedro
            • Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration