0
我有2個視圖,登錄和註冊。切換到另一個視圖時隱藏鍵盤
我做了[currentTextField resignFirstResponder];在我導航到另一個視圖之前。
問題是,鍵盤僅在切換視圖後隱藏。因此在另一個視圖上觸發了keyboardDidShow方法,這種方法混亂了。
2011-07-19 18:55:33.315 Prime Taxi Booking[601:207] Login view appear // lauched app
2011-07-19 18:55:34.952 Prime Taxi Booking[601:207] Login Keyboard appear // starts typing
2011-07-19 18:55:37.033 Prime Taxi Booking[601:207] Register view appeared // navigation
2011-07-19 18:55:37.036 Prime Taxi Booking[601:207] Login view disappear
2011-07-19 18:55:37.360 Prime Taxi Booking[601:207] Register Keyboard disappear // ?? how do I make this to disappear login keyboard instead?
我不知道爲什麼它只有在切換視圖後纔會resignFirstResponder,當我清楚地將它放在它上面時。
-(IBAction) registerButton:(id) sender
{
[currentTextField resignFirstResponder];
Registers *registerview = [[Registers alloc] initWithNibName:nil bundle:nil];
[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationTransition: UIViewAnimationTransitionCurlUp
forView:self.view.superview
cache:YES];
[UIView commitAnimations];
[self presentModalViewController:registerview animated:YES];
//[self.view addSubview:registerview.view];
}
好東西,起初我並不確定如何使用它,但不知何故學會了。真的很新鮮。非常感謝 :) –