Search code examples
iosorientationcgrect

Landscape frame when in Portrait mode


Is it possible to retrieve the frame a UIView will have in landscape mode, whilst the device/interface is in portrait mode? If so, how is this done?


Solution

  • MrThys, you should know how your view should be, either in portrait or landscape mode. After that, you can define them as constants like this:

    #define myViewPortrait CGRectMake(0.0f, 0.0f, 768.0f,1024.0f)
    #define myViewLandscape CGRectMake(0.0f, 0.0f, 1024.0f,768.0f)
    

    You could then use these values when your device changes orientation. :)