views:

332

answers:

2

I'm trying to replicate Apple's "Edit Details" functionality, where a grouped UITableView is shown with 1 row, and the entire cell is one big UITextView. For an example, go to the Contacts app, edit a contact, and add a Note field. That's what I'm going for.

The problem I'm having is when you rotate the phone. The first time you rotate (portrait -> landscape) everything is fine. But when you rotate back, the table disappears. No clue why, and I'm banging my head against the wall as to finding a solution. I've been working on this for literally days to no avail.

The first method I tried was to implement tableView:heightForRowAtIndexPath, returning different heights based on whether it was landscape or not.

Another implementation I tried was having 2 completely separate views in the controller:
UIView *landscape;
UIView *portrait;
and switching these in willAnimateRotationToInterfaceOrientation. No dice there either.

I've also tried fiddling with the bounds and frame of self.tableView, as well as self.tableview.contentOffset, but none of that seems to have any effect whatsoever.

Is there some example out there that I'm failing to google that already shows exactly what I want to do with rotation? I'd imagine this is a very common situation, but I haven't been able to find anything.

So I guess my question is, has anyone else ran into something like this before, and can at least point me in the right direction of where to look? Or knows of some common pitfalls that maybe I'm missing? I'm about to just say screw it and not allow rotation in the Edit Details view, but considering that's when users are most likely to want a landscape keyboard I'd really like to have it if possible...

Thanks for any help anyone can provide.

A: 

Please post some codes so we can help.

mfu
A: 

It probably has to do with the way you've anchored your objects in Interface Builder. Go into Interface Builder and pull up the inspector for the tableview. I think it's the third tab that has a set of arrows. The inner set of arrows controls the stretchiness of the object and the outer set of the arrows controls the anchors. Lock the left/right sides and choose either the top or bottom (or both if you're full screen).

You can test your view directly in Interface Builder (including rotating the view) so I suggest doing that to see that your new solution works.

Epsilon Prime