开发者

iPhone Keyboard hiding a UITextView when it comes in?

I am working on an iPhone Application and am attempting to get a Landscape View for a simple, editable UITextView working.

Both interface layouts are specified in NIB files, and I have succeeded in loading 开发者_如何学Gothem and migrating data when the devices rotates.

However, the UITextView in the Landscape version "runs away" from the iPhone Keyboard, making it impossible to see what you're editing. I have no idea why it is doing this--can anybody help?

Thanks in Advance!

VIDEO OF PROBLEM: http://www.youtube.com/watch?v=hfWBKBA_KjQ


No way to know what you are doing without some code, but you should try something like this:

- (void) animateTextField: (UITextView*) textView up: (BOOL) up
{
    const int movementDistance = 80; // tweak as needed
    const float movementDuration = 0.3f; // tweak as needed

    int movement = (up ? -movementDistance : movementDistance);

    [UIView beginAnimations: @"anim" context: nil];
    [UIView setAnimationBeginsFromCurrentState: YES];
    [UIView setAnimationDuration: movementDuration];
    self.view.frame = CGRectOffset(self.view.frame, 0, movement);
    [UIView commitAnimations];
}

Call this from where you think appropiate (UIKeyboardWillShowNotigication, for instance) and well, it will animate your view in order to show the textview.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜