It would be great if it really animated the best part of the screen, I think you mean that it actually compresses popUp, which is basically not very good. (what I see during rotation in my case). You cannot keep popUp from grinding, IF you move the view. The best way to deal with this is to temporarily move your entire main UIView to full screen using keyBoard by the difference between the size of your pop-up and how much that pop-up will shrink if you don't move it. you cannot just move it around the size of your keyboard, because popUps up high will also execute. This code is shown below when the keyboard is rotated, the same code when it is first entered. easy to do, EXCept, when you rotate the screen, then everything becomes complicated ...
in other words, sometimes your UIView does not move at all, sometimes it rises to a good 170 points.
// ----------------- find the top of the keyboard (also used on "didRotate") ---- very convenient, // took my watch to understand the absolute always work topOfKeyboard so here you go .-------
//-------------------------------------------------------------------------------- - (void)keyboardWillShow:(NSNotification*)notification { NSLog(@" keyboardWillShow"); UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; NSDictionary* info = [notification userInfo]; keyboardRect = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; keyboardRect = [(UIView*)keyWindow convertRect:keyboardRect toView:mainViewController.view]; keyboardIsVisible = TRUE; topOfKeyboard = keyboardRect.origin.y;
the hard part finds the bottom of PopUp, because in the popup window there is code or code convertRect: toView: code that makes the flaky origin (if you try to "view" the origin after "convertRect: toView": "code"), it wants to move and be at different points during rotation (or one of its super-views), so the bottom cutout comes out several times (unpredictable) due to the asynchronous process of rotating different elements, possibly because popUp itself has a lot of views in the pop-up window. (to see the problem with the popup window and it should be the keyboard that pops up, move the whole view up, then write down the "origin" and "size" of popUp after the code "convertRect: toView:") ... "origin" I am talking about the origin of the frame after it has been transferred to the main screen (or at least a couple of views up), with the code "convertRect: toView:" ....
update: (appears if you move about 3 supervisors from popUp, the composure goes away ... (this code below was in the ipad code like “didRotate”. That is, popup has several supervisors before you can get to the one that is projected onto top frame
UIPopoverController should probably have a property that has a coordinate origin, which is predicted after rotation in it, in the form of a “will rotate” (due to a keyboard problem) instead of “popoverContentSize”, (it should also include popoverContentSize, which would be without keyboard as another variable ".. anyway. Here's how I should have done it, see the code below.
//-------------------------------------------------------------------------------- - (void) checkRotation { NSLog(@" "); NSLog(@"checkRotation"); if (wasOffset) { wasOffset = false; [UIImageView beginAnimations:nil context:NULL]; [UIImageView setAnimationDuration:0.2f]; CGRect frame = carousel.frame; frame.origin.y += offset; carousel.frame = frame; [UIImageView commitAnimations]; [popPickerController presentPopoverFromRect:zoneButton.frame inView:[zoneButton superview] permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } if (popPickerController.popoverVisible) { if (keyboardIsVisible) { wasOffset = false; [popPickerController presentPopoverFromRect:zoneButton.frame inView:[zoneButton superview] permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO]; upView3 = [[[popPickerController.contentViewController.view superview] superview] superview]; //hey it works... :o) //NSLog(@" "); //NSLog(@"upView3.frame.origin.x = %f",upView3.frame.origin.x); //NSLog(@"upView3.frame.origin.y = %f",upView3.frame.origin.y); //NSLog(@"upView3.frame.size.height = %f",upView3.frame.size.height); //NSLog(@"upView3.frame.size.width = %f",upView3.frame.size.width); //NSLog(@" "); popUpRect.origin.x = upView3.frame.origin.x; popUpRect.origin.y = upView3.frame.origin.y; popUpRect.size.height = popUpSize.height; popUpRect.size.width = popUpSize.width; //you must save the size because the keyboard destroys it before you can use it. very tricky.... //NSLog(@" "); //NSLog(@"popUpRect.origin.x = %f",popUpRect.origin.x); //NSLog(@"popUpRect.origin.y = %f",popUpRect.origin.y); //NSLog(@"popUpRect.size.height = %f",popUpRect.size.height); //NSLog(@"popUpRect.size.width = %f",popUpRect.size.width); //NSLog(@" "); //NSLog(@" "); //NSLog(@"keyboardIsVisible = %d", keyboardIsVisible); //NSLog(@" "); //NSLog(@"keyboardRect.origin.x = %f",keyboardRect.origin.x); //NSLog(@"keyboardRect.origin.y = %f",keyboardRect.origin.y); //NSLog(@"keyboardRect.size.height = %f",keyboardRect.size.height); //NSLog(@"keyboardRect.size.width = %f",keyboardRect.size.width); //NSLog(@"topOfKeyboard = %f",topOfKeyboard); CGFloat bottomOfPicker = popUpRect.origin.y + popUpRect.size.height - amountShadowCanEncroach; //NSLog(@" "); //NSLog(@"bottomOfPicker = %f",bottomOfPicker); //NSLog(@"topOfKeyboard = %f",topOfKeyboard); //NSLog(@" "); if (bottomOfPicker > topOfKeyboard) { wasOffset = true; offset = bottomOfPicker - topOfKeyboard; NSLog(@"offset = %f",offset); [UIImageView beginAnimations:nil context:NULL]; [UIImageView setAnimationDuration:0.2f]; CGRect frame = carousel.frame; frame.origin.y -= offset; carousel.frame = frame; [UIImageView commitAnimations]; } } [popPickerController presentPopoverFromRect:zoneButton.frame inView:[zoneButton superview] permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } }
and moving the main UIView back
//----------------------------------------------------------------------------- - (void) searchDidEndEditing { NSLog(@"searchDidEndEditing"); keyboardIsVisible = false; if (wasOffset) { wasOffset = false; [UIImageView beginAnimations:nil context:NULL]; [UIImageView setAnimationDuration:0.2f]; CGRect frame = mainView.frame; frame.origin.y += offset; mainView.frame = frame; [UIImageView commitAnimations]; if (zoneButton.selected) [popPickerController presentPopoverFromRect:zoneButton.frame inView:[zoneButton superview] permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } }