ios - Sticky button below view and on top of keyboard -


i add button forms in app stickied bottom of view regardless of scrolling. how implement feature?

button @ bottom of view

button on top of keyboard

you going have make view direct child of main viewcontroller's view , position @ bottom of view. can done way wish. move "glue" bottom of view when keyboard displays or hides going have listen uikeyboardwillshownotification , uikeyboardwillhidenotification in nsnotificationcenter. when events fire can mimic animation duration , easing method , move bottom view or down amount given in willshow , willhide functions. this:

- (void)keyboardwillshow:(nsnotification *)anotification {     nsdictionary* userinfo = [anotification userinfo];      // animation info userinfo     nstimeinterval animationduration;     uiviewanimationcurve animationcurve;      cgrect keyboardendframe;      [[userinfo objectforkey:uikeyboardanimationcurveuserinfokey] getvalue:&animationcurve];     [[userinfo objectforkey:uikeyboardanimationdurationuserinfokey] getvalue:&animationduration];       [[userinfo objectforkey:uikeyboardframeenduserinfokey] getvalue:&keyboardendframe];       [uiview beginanimations:nil context:nil];     [uiview setanimationduration:animationduration];     [uiview setanimationcurve:animationcurve];     //do whatever here, move bottom view     [uiview commitanimations]; } 

Comments