ios - Stick element to the keyboard bottom during animations -
i'm struggling keyboard in ios 8 trying glue element above during animations. in messages have input pushing appearing keyboard. i've found lots of topics here, of them how handle appearing keyboard, not dismissal. seems apple use other curve or speed whatever dismissal, have asynchronism when close keyboard, while appearing animation synchronised.
here i've got now:
[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillhideorshow:) name:uikeyboardwillshownotification object:nil]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillhideorshow:) name:uikeyboardwillhidenotification object:nil]; - (void)keyboardwillhideorshow:(nsnotification *)note { nsdictionary *userinfo = note.userinfo; cgrect keyboardendframe = [userinfo[uikeyboardframeenduserinfokey] cgrectvalue]; [self adjustformcontainersize]; // method opening orange card uiviewanimationcurve curve = [userinfo[uikeyboardanimationcurveuserinfokey] unsignedintegervalue]; uiviewanimationoptions options = (curve << 16) | uiviewanimationoptionbeginfromcurrentstate; nstimeinterval duration = [userinfo[uikeyboardanimationdurationuserinfokey] doublevalue]; self.buttoncontainerbottom.constant = keyboardendframe.size.height; [uiview animatewithduration:duration delay:0.0 options:options animations:^{ [self.view layoutifneeded]; } completion:nil]; }
and result in simulator: http://monosnap.com/file/bwxjdthpgzcqjnxeqleg5bb8smvxdb
what's wrong backward animation, how synchronise it?
Comments
Post a Comment