iOS - PageView controller with UITableView resize

2019-08-29 05:44发布

问题:

I have a controller with twoUIViews the first one have 200 of height(constant across all iPhones) and the second oneUIViews contain aPageViewController and should get the rest of the height and it does.

The problems come when theUITableView get the data, It resize theUIView, with the resize, theUIView now have more height than it should have ( because tableView resized it) and I am not able to scroll to the last object.

Example: Height screen = 600

First UIView = 200;

Second UIView = 400;

Now the UITableView get the data and loads it and resize

First UIView = 200;

Second UIView = 600;

but the screen have only 600.

I tryed lots of options, try to resize the table with the original width and height of the second UIview before resize on viewDidLayoutSubviews

- (void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];

float a = self.tabla.frame.size.height;
float a2 = self.tabla.superview.frame.size.height;
//self.tabla.superview.autoresizesSubviews = false;
//self.tabla.frame = CGRectMake(self.tabla.frame.origin.x,self.tabla.frame.origin.y,self.tablaSizeWidth,self.tablaSizeHeight);
}

I also tryed to desactivate the AutoLayout of theTableView and it worked! but if I desactivate it, it desactivate for all the whole storyboard and my second UIView cant get the rest of the height (Seriously apple?!)

Constraints of UIView containing the page controller

View of all the constraints and the layout

Note: Main view background is setted to green and PageAdapter background is setted to black.

How I can make it?