atish3 / ios-team

iOS app for MDP free speech team
Other
5 stars 2 forks source link

Text display bug in compose view #23

Closed yufansun closed 8 years ago

yufansun commented 8 years ago

Sometimes my input text doesn't show up on the compose view screen. This bug happened in my and Sindy's phones during test. Still trying to figure out when this bug happens and how to solve it.

img3

psturmfels commented 8 years ago

Hm I see the screenshot, but I can't seem to replicate this problem on any of my hardware simulators, nor can I replicate it on my phone. Let me dig through the code and see if anything obvious jumps out at me.

psturmfels commented 8 years ago

I took a stab at solving this problem with a2e61f7f1f578ef25d315f691fc2a10766676d11, although I have no idea whether the solution actually worked. Could you try testing what you did again and seeing whether the problem still occurs as of the latest push?

yufansun commented 8 years ago

This doesn't work. But I realized this bug happen in my phone when I change my keyboard. (eg. if I change from English keyboard to Emoji and change back to English, the placeholder and UITextfield both disappears)

psturmfels commented 8 years ago

Dang. Hmm I still can't seem to replicate this bug. You'll have to show me in person.

qinyeli commented 8 years ago

The errors occurs only in Yufan and my phone because we have multiple language keyboard. Every time we switch language, keyboardWillShow is called, but keyboardWillHide is not. As a result, the following line is run for multiple times.

self.composeTextView.frame.size.height -= keyboardFrame.height

It is confusing though as I switch between 4 language keyboards, sometimes keyboardWillShow is not called, sometimes called once, sometimes twice. Basic observations are

Given the complexity, I would say simply rewriting the code as

self.composeTextView.frame.size.height = SOME_CONSTANT - keyboardFrame.height

is the easiest way to fix the bug.

yufansun commented 8 years ago

Yes, you are right. I fixed the bug on my phone simply by changing self.composeTextView.frame.size.height -= keyboardFrame.height in keyboardWillShow function to self.composeTextView.frame.size.height = keyboardFrame.height

psturmfels commented 8 years ago

Does this fix work? Can we close this issue/Can you push the solution?

yufansun commented 8 years ago

The bug is fixed. I cannot push to master directly, so created a new branch and pushed my changes there: a2e61f7f1f578ef25d315f691fc2a10766676d11