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

resignFirstResponder is called when table cell is at bottom of UITableView #2

Open
mawilmsen opened this issue Dec 16, 2011 · 4 comments

Comments

@mawilmsen
Copy link

Hey,

first: I love your PickerTableViewCell! Thanks for publishing this nice piece of code.

Unfortunately, I have two issues and am not being able to solve them (I will opentwo tickets here). Would be great if you could help. I am talking about iPhone. On iPad I didn't find any issues.

I am using the SimplePickerTableViewCell. If a tableview is large (has a few cells so that at least one cell is near to the bottom of the screen), then resignFirstResponder is called for this cell immediately after selecting it. So the cell looses focus immediately after selecting it.

However - the Picker and AccessoryView are visible, though. But due to the early call of resignFirstResponder, the cell isn't higlighted anymore, and - much more important - the value is not updated when the "done" button is pressed. Only if I select the same cell again, and it becomes first responder for at least a short time frame, the value is updated.

It only happens if a cell is close to the bottom of the table, so I guess it has something to do with the scrolling of the tableview if the picker appears.

I tried to debug a little bit to find out who is calling resignFirstResponder so early, but couldn't come to a solution. Doe you have any ideas/hints for me?

Kind regards, maw

@wannabegeek
Copy link
Owner

I can't seem to reproduce this problem.
Do you have the latest code? There was a fix merged in earlier today related to the resignFirstResponder & deselecting of table view cells, however this doesn't sound like your issue.

Thanks,
Tom

@mawilmsen
Copy link
Author

Hmm,

I just realized my described issue only belongs to the simulator. On my real device it's like you said: no problem at all. Very good, although confusing.

Btw: sometimes the table cell gets updated with new selections while the picker is still open, sometimes not (but always if the picker is closed). Have you registered that before?

Cheers / maw

@mawilmsen
Copy link
Author

Hi again,

Btw: sometimes the table cell gets updated with new selections while the picker is still open, sometimes not (but always if the picker is closed). Have you registered that before?

I found out why. If the cell textLabel.text is nil, then the cell will not update immediately. Solved it now by setting a placeholder text "- don't care -" if no value is selected.

Regarding the "only in the simulator issue": After several tests, I can confirm this only happens in the simulator. I really hope, it doesn't behave different on different platforms/iOS versions. I am using the pretty old 3G with iOS 4.2.1 for testing. Which one are you using? Can you confirm it behaves properly on 4G/4GS with iOS 5 also?

Regards / maw

@wannabegeek
Copy link
Owner

I have an iPhone 4 running iOS 5, so that is all I have really tested with! I do have a 3G available, so I'll try testing on that too.

The code was written assuming you are using ARC (automatic reference counting) which is only available in iOS 5.
For example you'll notice there are no retain/release calls - I should probably make the code backwards compatible.

I'll take a look at the "not updating when the textLabel.text is nil" issue.

Thanks,
Tom

On 17 Dec 2011, at 14:08, mawilmsen wrote:

Hi again,

Btw: sometimes the table cell gets updated with new selections while the picker is still open, sometimes not (but always if the picker is closed). Have you registered that before?

I found out why. If the cell textLabel.text is nil, then the cell will not update immediately. Solved it now by setting a placeholder text "- don't care -" if no value is selected.

Regarding the "only in the simulator issue": After several tests, I can confirm this only happens in the simulator. I really hope, it doesn't behave different on different platforms/iOS versions. I am using the pretty old 3G with iOS 4.2.1 for testing. Which one are you using? Can you confirm it behaves properly on 4G/4GS with iOS 5 also?

Regards / maw


Reply to this email directly or view it on GitHub:
#2 (comment)

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