0
我有TextField1和TextField2
我想滾動滾動視圖只有當顯示鍵盤由於TextField2。 這是我的實際代碼。
有沒有解決方法?有條件的滾動視圖
-(void) viewWillAppear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidShow:)
name:UIKeyboardDidShowNotification
object:self.view.window];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidHide:)
name:UIKeyboardDidHideNotification
object:nil];
}
-(void) keyboardDidShow:(NSNotification *) notification {
self.ScrollView.center = CGPointMake(self.originalCenter.x,
self.originalCenter.y-100);
}
-(void) keyboardDidHide:(NSNotification *) notification {
self.ScrollView.center = CGPointMake(self.originalCenter.x,
self.originalCenter.y);
}
GREAT!非常感謝,用你的回答解決了,ciao! – Beppino66