0
votes

i have a viewcontroller which has tableview as subview. when i try to change the height of the viewcontroller view, tableview height is not changing. but when i manually get the tableview and set it's height. it's working. Here my sample code.

ViewController *view = [[ViewController alloc]init];

In ViewController

UITableview *tableView = [[UITableView alloc]init]; // @property, @synthesize are added. tableview frame size is added as view size.

[self.view addSubView:tableVIew];

but when i try to change the ViewController frame. tableview inside ViewController is not changing, it still has original value.

Any Help.

1

1 Answers

0
votes

Try adding:

[tableView setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];

This should ensure that the table view gets resized when it's superview's frame changes