How to resize UITableView in UITableViewController with section header

后端 未结 5 1126
情话喂你
情话喂你 2020-12-29 13:14

I\'ve got a grouped UITableView in a UITableViewController and I want to resize it horizontally.

I tried many different ways but none of them was perfect.

5条回答
  •  遥遥无期
    2020-12-29 13:40

    If you call - [UITableView setFrame:] from - [UITableViewController viewDidAppear:], it works:

    - (void)viewDidAppear:(BOOL)animated
    {
        [self.tableView setFrame:CGRectMake(x, y, w, h)];
    }
    

    In order to avoid having black bars on each side of the table view, set the background color of the application's main window to white:

    [[[UIApplication sharedApplication] keyWindow] setBackgroundColor:[UIColor whiteColor]];
    

提交回复
热议问题