Game Development Community

iPhoneTextEntry.xib Landscape Mode

by Lowell Duke · in iTorque 2D · 07/30/2010 (1:10 am) · 2 replies

Hey everyone,

I've read some threads on the iphoneTextEntry and how to use it. I know it's not exactly turn-key but I prefer being able to follow this type of design and create my own xibs. For example, soon I'll need to bring up a full-blown UITableView in landscape mode to browse user created levels for the game.

Anyway, I've written a TON of apps for the iPhone, but they've all been portrait. When you bring up the textentry xib in Torque, although the keyboard comes up in landscape mode, the xib view is still in portrait mode and thus doesn't extend the full width of the 480 pixels. I've tried several things I've found around the net but no matter what I do, I can't seem to get this view controller to come up in landscape mode!

No doubt my experience in landscape mode is weak, but I've done the simple auto rotation callback etc... just can't seem to effect this particular xib.

Has anyone been able to get the view to properly fill landscape mode? Any advice here would be greatly appreciated.

Thanks a bunch,
Lynn

#1
07/30/2010 (1:15 am)
every controller must implement the autorotate handler on its own and specify the rotations valid for himself
#2
07/30/2010 (2:21 am)
Ah yes, there were two pieces. I had the callback you mentioned.

But in the actual view controller, there's some funky manual rotation animation that interferes with rotation automation. It really prevented me from getting the desired effect which was to rotate nicely to any orientation. So for others who come across this thread..add this code to the iPhoneTextEntryController.mm file:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}

And remove the manual rotation in:

bool iPhoneTextEntry::getUserText(StringBuffer& text)

Keep in mind you might want to filter certain orientation in the callback. The code above will rotate to all 4.

Thanks Marc.