Autoresize of uiview

I have a UIView in a UITabController . And it has a UITableView in it.

When you switch in the call status bar, this does nothing, and the view does not change automatically.

It takes the correct size based on whether the UIStatusBar call was UIStatusBar when the application was launched, but if the UIStatusBar parameter UIStatusBar enabled while the application is running, nothing changes.

Another tab view with the UINavigationController seems to resize.

Here is the code

  if ([indexPath indexAtPosition: 0] == 0 || [indexPath indexAtPosition: 0] == 1) {
         if (! airportChooser) {
             airportChooser = [[AirportChooserController alloc] init];
             airportChooser.targetController = self;
             airportChooser.view.autoresizesSubviews = YES;  
             airportChooser.view.autoresizingMask = UIViewAutoresizingFlexibleHeight;
             [airportChooser.view setAutoresizingMask: UIViewAutoresizingFlexibleWidth |  UIViewAutoresizingFlexibleWidth];
         }
         airportChooser.target = [indexPath indexAtPosition: 0];
         [self.parentViewController.parentViewController.view addSubview: airportChooser.view];
         self.parentViewController.parentViewController.view.autoresizesSubviews = YES;
         self.parentViewController.parentViewController.view.contentMode = UIViewContentModeRedraw;
         [self.parentViewController.parentViewController.view setAutoresizingMask: UIViewAutoresizingFlexibleWidth |  UIViewAutoresizingFlexibleWidth];
         airportChooser.view.contentMode = UIViewContentModeRedraw;
         // [airportChooser open];
     }
+6
objective-c iphone uitableview autoresize uistatusbar
source share
2 answers

Have you set the UIView resize mask UIView ? You can set it in Interface Builder on the size tab, these are red lines that you can click.

You can also install it in code using something like:

 [view setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; 

Also make sure that the supervisor has installed autoresizesSubviews in YES.

Further information on this can be found in the UIView documentation .

+13
source share

While klaaspeiter's answer makes sense, and in some cases it might be the correct answer in my particular case, this was because I was adding an extra view to the UINavigationController with addSubview instead of pushViewController: view animated: NO;

0
source share

All Articles