Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8356991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:20:54+00:00 2026-06-09T10:20:54+00:00

i want resize a UINavigationBar and a UITableView connected with .xib file when the

  • 0

i want resize a UINavigationBar and a UITableView connected with .xib file when the orientation change in my iPad application, now i’ll do this:

- (void)viewWillAppear:(BOOL)animated {

UIInterfaceOrientation currentOrientation = [[UIApplication sharedApplication] statusBarOrientation];
if (UIInterfaceOrientationIsLandscape(currentOrientation)) {
    [self.seriesTable setFrame:CGRectMake(self.seriesTable.frame.origin.x, self.seriesTable.frame.origin.y, 425, self.seriesTable.frame.size.height)];
    [self.myNavBar setFrame:CGRectMake(self.myNavBar.frame.origin.x, self.myNavBar.frame.origin.y, 425, self.myNavBar.frame.size.height)];
} else {
    [self.seriesTable setFrame:CGRectMake(self.seriesTable.frame.origin.x, self.seriesTable.frame.origin.y, 670, self.seriesTable.frame.size.height)];
    [self.myNavBar setFrame:CGRectMake(self.myNavBar.frame.origin.x, self.myNavBar.frame.origin.y, 670, self.myNavBar.frame.size.height)];
}
}

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
    NSLog(@"landscape");
    [self.seriesTable setFrame:CGRectMake(self.seriesTable.frame.origin.x, self.seriesTable.frame.origin.y, 425, self.seriesTable.frame.size.height)];
    [self.myNavBar setFrame:CGRectMake(self.myNavBar.frame.origin.x, self.myNavBar.frame.origin.y, 425, self.myNavBar.frame.size.height)];

} else {
    NSLog(@"portrait");
   //[self.view setFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, 678, self.view.frame.size.height)];
    [self.seriesTable setFrame:CGRectMake(self.seriesTable.frame.origin.x, self.seriesTable.frame.origin.y, 670, self.seriesTable.frame.size.height)];
    [self.myNavBar setFrame:CGRectMake(self.myNavBar.frame.origin.x, self.myNavBar.frame.origin.y, 670, self.myNavBar.frame.size.height)];

}
}

when the app start the frame size is correct, but when i change orientation go in the will rotate.. method but the frame don’t change the size, and to resize it i have to switch to another UITabBar tab and then return to that view and obviously pass in the viewwillappear method and resize the view, but when the orientation change nothing happen, how i can do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:20:55+00:00Added an answer on June 9, 2026 at 10:20 am

    Following code this will help you to change the Webview size based on the Orientation

    -(void)viewWillAppear:(BOOL)animated
    {
        [super viewWillAppear:animated];
    
        [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector (orientationchangefunction:) name:UIDeviceOrientationDidChangeNotification object:nil];
        [self orientationchngfn];
    
    }
    
    
    
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        if(interfaceOrientation == UIInterfaceOrientationPortrait) 
        {
            orientseason=0;
        }
        if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft) 
        {
            orientseason=1;
        }
        if(interfaceOrientation == UIInterfaceOrientationLandscapeRight) 
        {
            orientseason=1;
        }
        if(interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) 
        {
            orientseason=0; 
        }
        if(orientseason==0)
        {   
        }
        else if(orientseason==1)
        {
    
        }
    
        return YES; 
    }
    
    -(void) orientationchangefunction:(NSNotification *) notificationobj
    {
    
        [self performSelector:@selector(orientationchngfn) withObject:nil afterDelay:0.0];
    }
    -(void) orientationchngfn
    {
        UIDeviceOrientation dorientation =[UIDevice currentDevice].orientation;
    
        if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
    
            if(UIDeviceOrientationIsPortrait(dorientation))
    
            {
                orientseason=0;
            } 
            else if (UIDeviceOrientationIsLandscape(dorientation))
            {
                orientseason=1;
            }
            if(orientseason==0)
            {
                webview4Html.frame=CGRectMake(5, 44, 310, 419);
    
    
            }
            else if(orientseason==1)
            {
                webview4Html.frame=CGRectMake(5, 44, 470, 276);
    
            }
    
        }
        else {
            if(UIDeviceOrientationIsPortrait(dorientation))
    
            {
                orientseason=0;
            } 
            else if (UIDeviceOrientationIsLandscape(dorientation))
            {
    
                orientseason=1;
            }
            if(orientseason==0)
            {
                webview4Html.frame=CGRectMake(5, 44, 758, 940);
    
    
            }
            else if(orientseason==1)
            {
                webview4Html.frame=CGRectMake(5, 44, 1014, 684);
    
            }
        } 
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to resize the dialog dynamically just before I open it, but this
I want to resize an image without UIScrollView in iPhone application. I want to
I want to resize div. This div contains image. I want to resize image
I have a image under div id myimage. Now I want to resize it
I do not want to resize or change the position of the components on
I created UItableViewController . I want to resize the table and add my application
I want to resize an image in RaphaelJS following this example: ... . You
I want to resize image in linux and want this image to be convert
I want to resize the font of my UITableView cells. If they contain too
I want to resize the command prompt window in a batch file, is it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.