實施UIKeyboardDidShowNotification
和UIKeyboardWillHideNotification
,所以你可以做的Web視圖復位。
實施例:
- (void)viewDidLoad
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
}
- (void)keyboardWasShown:(NSNotification *)notification
{
//align Web-view here
}
- (void)keyboardWillHide:(NSNotification *)notification
{
//align Web-view here
}
- (void)viewDidUnload
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}