ios - Rotating iPhone and changing views -


i've never played around iphone being landscape, have working iphone app assuming user viewing iphone upright. i'd play around rotating phone, , in order that, did simple:

i added following code view controller:

-(void)willrotatetointerfaceorientation: (uiinterfaceorientation)orientation duration:(nstimeinterval)duration {     nslog(@"will rotate interface orientation: %@",orientation);      if ((orientation == uiinterfaceorientationlandscapeleft) || (orientation == uiinterfaceorientationlandscaperight))         tableview.frame = cgrectmake(0, 0, 480, 320);     else         tableview.frame = cgrectmake(0,73,320,390);   } 

and i'm getting bad_access error. don't see view load @ all. so, what's problem, , how implement willrotate method when phone rotates, can resize components?

the crash caused line:

nslog(@"will rotate interface orientation: %@",orientation); 

orientation enum value, therefore format specifier should %i not %@.

the simplest way support rotating implement:

- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation 

return yes orientations wish support. not doing resizing in method. use views struts , springs ensure resize , reposition correctly alternate rotations.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -