ios - UIKeyboard notification handler triggered 3 times -
my code:
-(void)viewwillappear:(bool)animated { [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(handlekeyboard:) name:uikeyboardwillchangeframenotification object:nil]; } -(void)viewwilldisappear:(bool)animated { [[nsnotificationcenter defaultcenter] removeobserver:self]; } -(void)handlekeyboard:(nsnotification*)notification { nslog(@"triggered"); }
see:
the disappearing handler triggered once normal, 3 times when appears. ios bug?
possibly not helpful problem need calling [super viewwill…
overrides.
-(void)viewwillappear:(bool)animated
-(void)viewwilldisappear:(bool)animated
from docs.
if override method, must call super @ point in implementation.
Comments
Post a Comment