0

I made a viewcontroller XIB as 4" retina screen and put a custom view at the bottom.
And I run the app on the iPhone4 3.5" simulator.
My app should be supported on most of iPhone versions, so I set the view's frame on the view controller's viewdidload. And I was going to hide the view at the first time, as a result the view's frame was set to {{-320, 401}, {320, 147}}.
But in the viewwillappear, I found the view's frame was reset as {{0, 313}, {320, 147}}.

I wonder why this frame was changed automatically.

Thanks for any help.

ttotto
  • 826
  • 3
  • 13
  • 31

1 Answers1

0
Try This Code

+(BOOL)isDeviceiPhone5
{
    BOOL iPhone5 = FALSE;

    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    if (screenBounds.size.height == 568) {
        // code for 4-inch screen
        iPhone5 = TRUE;
    }
    else
    {
        iPhone5 = FALSE;
        // code for 3.5-inch screen
    }
    return iPhone5;

}


+(CGRect )getFrameFor_iPhone4_height:(CGRect)frame
{
    frame.size.height = frame.size.height - 87.0;
    return frame;
}
+(CGRect )getFrameFor_iPhone4_yPos:(CGRect)frame
{
    frame.origin.y = frame.origin.y - 87.0;
    return frame;
}
Mubin Shaikh
  • 374
  • 4
  • 9