views:

165

answers:

2

Hi all

I am resizing the navigation bar when my application switches into landscape orientation. But i am not able to set the content size of navigation bar according to its height.

Landscape image :- In this image the top left bar item and title of navigation bar are not resizing when it switches into landscape orientation....they should get re sized according to height of navigation bar.

Please suggest me any idea for it?

Thanks
Deepika

+1  A: 

override the method:

- (UIView *)rotatingHeaderView
{
    return yourNavigationBar;
}

this method will get called when your device orientation takes place.

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if(mainLoginView.superview == self.view || modulesView.superview == self.view)
    {
        return NO;
    }
    else
    {
        return YES;
    }
}

replace this method with your code and reply me what happens :)

Manjunath
Thanks for your suggestion. I have tried it but it is not working for me.This method is not getting called when device orientation takes place.
Deepika
you are returning YES in the delegate shouldAutorotateorientation right?
Manjunath
I have many views and navigation controller in my application. I want to do this thing :- If login view or module view is visible then restrict the orientation and if any navigation controller view is visible then I am rotating that navigation view by transformation. Then I am setting the height of navigation bar according to orientation.I am able to set the height of navigation bar but I am not able to set the size of UIBarButtonitem and title of navigation bar. You Can see it in Landscape Image.
Deepika
Code which I am using, is posted as answer.
Deepika
Just look at the edited answer and reply me ASAP.Note:"Copy and paste both methods in my answer and check what happens".
Manjunath
Thanks for your reply.My problem is resolved now...I was setting the height of navigation bar as 34 when I set the height of navigation bar as 32....all contents of navigation bar automatically got re-sized.
Deepika
A: 

I am doing in this delegate method:-

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
    if(mainLoginView.superview == self.view || modulesView.superview == self.view){
        return NO;
    }else{
        [self rotateTheNavigation:contactsNavigation withOrientation:interfaceOrientation];
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
}
Deepika