News for hackers. Stuff that matters.
Re:Show HN: iOS Table View that automatically adjusts with k... by thought_alarm on Tuesday March 20, 2012 @03:48AM (#3728228)
You should be setting the TableView's `contentInset` and `scrollIndicatorInsets` properties, rather than adjusting the TableView's frame.

Convert the keyboard frame to the superview's coordinate system using `-convertRect:fromView:`, e.g. :

    keyboardFrame = [tableView.superview convertRect:keyboardFrame
                                            fromView:tableView.window];
The bottom inset is then simply the difference between the TableView's height and the keyboard's Y coordinate.

You would also set those properties and scroll to the selected row in the same animation block.

Re:Show HN: iOS Table View that automatically adjusts with k... by bobspryn on Tuesday March 20, 2012 @03:51AM (#3728236)
I believe I started to try that method but ran into issues. Wasn't aware of the scrollIndicatorInsets though, so maybe that was the issue.

Would that method have any significant advantages? Less code? Would it avoid all the crazy frame calculations depending on the rotation?

Re:Show HN: iOS Table View that automatically adjusts with k... by thought_alarm on Tuesday March 20, 2012 @03:57AM (#3728255)
Yes, `-convertRect:fromView:` replaces your frame calculations based on rotation.
Re:Show HN: iOS Table View that automatically adjusts with k... by bobspryn on Tuesday March 20, 2012 @04:03AM (#3728270)
Ah yes. I see now that I totally missed the fact that the keyboard rect also needed to be converted. Well that was a painful point to miss!

Cool. I'll give that a whirl. Those rotation bits were a biatch. Thanks for the pointers.