Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard breaks when selecting a non-editable UITextView #37

Closed
GarethWalters opened this issue Apr 7, 2013 · 3 comments
Closed

Keyboard breaks when selecting a non-editable UITextView #37

GarethWalters opened this issue Apr 7, 2013 · 3 comments

Comments

@GarethWalters
Copy link

Selecting text within a non-editable text view causes the UI to become unresponsive. Try adding this code to the DAKeyboardControl example project.

UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 50, 320, 50)];
[textView setText:@"Example text to select."];
[textView setEditable:NO];
[self.view addSubview:textView];
@danielamitay
Copy link
Owner

Interestingly enough, when that occurs, the system is actually presenting a keyboard!
The keyboard's frame? {(inf, inf), (0.0f, 0.0f)}

When this occurs, the actionHandler block attempts to resize the UITableView to a CGRect with a height of CGFLOAT_MAX!

So yeah that's crazy. Quick fix, put this at the beginning of your actionHandler block:

if (CGSizeEqualToSize(keyboardFrameInView.size, CGSizeZero))
{
    return;
}

I am currently looking for an elegant solution to incorporate directly into DAKeyboardControl and will have a fix pushed by tomorrow.

@GarethWalters
Copy link
Author

Awesome; thanks for the quick update!
I just gave that a shot and it solves the issue in my app.

@danielamitay
Copy link
Owner

Thanks again for finding this. DAKeyboardControl now sanity checks for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants