0

I have storyboard as below.

enter image description here

Here I am giving option as English or Arabic.

When I run on 4s screen (iOS 7), it looks like below.

enter image description here

When I click on English, I see the scrollView.

enter image description here

In Appdelegate.m, I have

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    if (IS_DEVICE_RUNNING_IOS_7_AND_ABOVE()) {

        NSLog(@"This is iOS 7 iphone...");

        [[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleLightContent];

        NSLog(@"self.window.frame.size.width==%f", self.window.frame.size.width);
        NSLog(@"self.window.frame.size.height==%f", self.window.frame.size.height);

        background = [[UIWindow alloc] initWithFrame: CGRectMake(0, 0, self.window.frame.size.width, 20)];
        background.backgroundColor = [UIColor whiteColor];
        [background setHidden:NO];

        self.window.clipsToBounds = YES;
        self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
        NSLog(@"self.window.frame.size.height==%f", self.window.frame.size.height);
        self.window.bounds = CGRectMake(0, 0, self.window.frame.size.width, self.window.frame.size.height);
    }

    return YES;
}

All this works smoothly

Now let me run this on iOS 6, iPhone 4s.

Yuckk!!! All things shift down.

Below is what I see (its ugly, isn't it?)

enter image description here

(this image is edited image as the iPhone I am using is mine friend iPhone and I don't want to access his photos :D :P (top status bar is black in iPhone)).

Any reason why this is happening?

Note : Autolayout is ON & I want it active and hence I cannot use delta part

The problem is not about UIPickerView. The problem is UIView gets shifted down and there is white space. If I click on English, I see UIPickerView at its right place. The only problem is view is getting shifted.

Sample project is at dropbox


Answer

I solved it by adding constrains in yellow image

Community
  • 1
  • 1
Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276

1 Answers1

1

I solved my problem by adding CONSTRAINTS for yellow image.

This is something weird but it happened to me.

Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276