How to change the height of table view in iOS?

I am a beginner in iOS application development. I am getting problem when I set the frame of table view, it is not working.
I use this code to set the frame:
[self.tableView setFrame:CGRectMake(0, 0, 240, 360)];

but it does't change the table view frame.
Please any one tell me how can I set the frame of table view..?

Last updated:4/5/2016 2:05:15 AM

1 Answers

Tarun Kumar
Tarun Kumar

If you have getting issue after setting the tableview frame then you can also use the method viewDidLayoutSubviews:.
Use your table view frame set code in the viewDidLayoutSubviews: method.
Below I have provided an example:

- (void) viewDidLayoutSubviews
{
    [self.tableView setFrame:CGRectMake(20, 10, 200, 300)];
}

I hope it will resolve your table view frame set issue.

Answer