[[Nsnotificationcenter defaultcenter]addobserver:self selector: @selector (keyboardwillappear:) Name: Uikeyboardwillshownotification Object:nil];
[[Nsnotificationcenter defaultcenter]addobserver:self selector: @selector (keyboardwilldisappear:) Name: Uikeyboardwillhidenotification Object:nil];
}
-(CGFloat) Keyboardendingframeheight: (nsdictionary *) userinfo//calculate the height of the keyboard
{
CGRect keyboardendinguncorrectedframe = [[UserInfo objectforkey:uikeyboardframeenduserinfokey]cgrectvalue];
CGRect keyboardendingframe = [Self.view convertrect:keyboardendinguncorrectedframe fromView:nil];
return keyboardEndingFrame.size.height;
}
-(void) Keyboardwillappear: (nsnotification *) notification
{
CGRect currentframe = self.view.frame;
NSLog (@ "CURRENTFRAME.ORIGIN.Y:%f", CURRENTFRAME.ORIGIN.Y);
if (currentframe.origin.y!=0.00) {
Return
}
CGFloat change = [self keyboardendingframeheight:[notification userInfo];
CURRENTFRAME.ORIGIN.Y =-60;
Self.view.frame = Currentframe;
}
-(void) Keyboardwilldisappear: (nsnotification *) notification
{
CGRect currentframe = self.view.frame;
CGFloat change = [self keyboardendingframeheight:[notification userInfo];
CURRENTFRAME.ORIGIN.Y = 0.0;//currentframe.origin.y + change;
Self.view.frame = Currentframe;
}
iOS pop-up keyboard view pan up