user3218052
user3218052

Reputation: 11

Device Orientation issue in iPhone/iPad iOS7

In my application i use both devices iPhone and iPad.Now the main problem is device orientation.i wanna use both portrait and landscape orientation.but i got this type of view when i rotate to right or left as below.

Also when i turned on autolayout option check then i also found new image like this.

When turned on autolayout

This is original image

this when landscape

i use firstViewController and also i put method for orientation and when i put breakpoint on it, it is not called and here is my code:

in fVC.m:

    -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    if (interfaceOrientation == UIDeviceOrientationLandscapeLeft || interfaceOrientation == UIDeviceOrientationLandscapeRight)
    {
        if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
            locationBtn.frame = CGRectMake(200,200,86,86);
           cameraBtn.frame  = CGRectMake(200,200,86,21);

        }

        else

        {

            locationBtn.frame = CGRectMake(200,200,86,86);
            cameraBtn.frame  = CGRectMake(230,200,86,21);
        }
}
    return 0;
}

Upvotes: 0

Views: 145

Answers (3)

thatzprem
thatzprem

Reputation: 4767

Just enabling Autolayout doesn't add any constraints.

Select your items in .XIB and choose reset to selected constraints.

This might help you achieve what you are expecting.

I would recommend you learn and start using Autolayout. Quick link to help you get started: http://www.youtube.com/watch?v=r1sc7NI6-wo

Change to do:

enter image description here

Output:

enter image description here

enter image description here

Upvotes: 0

Jef
Jef

Reputation: 4728

-(BOOL)shouldRotate.... Is no longer called as of iOs7.
Try moving this code to -(void)didRotate.. Or (better, because your animations will sync with the built in ones)

-(void)willRotate...

Upvotes: 0

Ashish Kakkad
Ashish Kakkad

Reputation: 23892

Properties

Change in properties as per your need ..

You want to enlarge or you want to place elsewhere .. ..

Upvotes: 1

Related Questions