ios - Updating tableview view for a chat application -


i'm implementing real time chat in app using firebase , and if keyboard shown , user sends me 10 messages in row, messages start hiding behind keyboard or go out below tableview view (if keyboard isn't shown). believe has adjusting view adjust number of rows within tableview. ultimately, need latest cell right above textfield (whether keyboard shown or not) every time send message or receive latest message. tips? took @ firechat on github , don't seem have code this: https://github.com/firebase/firechat-ios/blob/master/firechat/viewcontroller.m

- (void)viewwillappear:(bool)animated {     [[nsnotificationcenter defaultcenter]     addobserver:self selector:@selector(keyboardwillshow:)     name:uikeyboardwillshownotification object:nil];      [[nsnotificationcenter defaultcenter]      addobserver:self selector:@selector(keyboardwillhide:)      name:uikeyboardwillhidenotification object:nil]; }  - (void)keyboardwillshow:(nsnotification*)notification {     [self moveview:[notification userinfo] up:yes]; }  - (void)keyboardwillhide:(nsnotification*)notification {     [self moveview:[notification userinfo] up:no]; }  - (void)moveview:(nsdictionary*)userinfo up:(bool)up {     cgrect keyboardendframe;     [[userinfo objectforkey:uikeyboardframeenduserinfokey]      getvalue:&keyboardendframe];      uiviewanimationcurve animationcurve;     [[userinfo objectforkey:uikeyboardanimationcurveuserinfokey]      getvalue:&animationcurve];      nstimeinterval animationduration;     [[userinfo objectforkey:uikeyboardanimationdurationuserinfokey]      getvalue:&animationduration];      // correct keyboard size slide right amount.     [uiview beginanimations:nil context:nil];     [uiview setanimationbeginsfromcurrentstate:yes];     [uiview setanimationduration:animationduration];     [uiview setanimationcurve:animationcurve];      cgrect keyboardframe = [self.view convertrect:keyboardendframe toview:nil];     int y = keyboardframe.size.height * (up ? -1 : 1);     self.view.frame = cgrectoffset(self.view.frame, 0, y);      [uiview commitanimations]; } 


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -