2012-01-18 68 views
0

正在我的tableview中使用自定义单元格与背景图像。当方向更改单元格大小未发生变化时,我需要在方向更改时自动更改自定义单元格大小。如何实现此目的?更改UItableview自定义单元格的宽度

+0

如果你用xib创建u cell然后使用autoresize。另外明智地设置框架 – Ron 2012-01-18 04:52:27

回答

1

您可以委托编程设定的tableview框架 -

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

您可以使用

[tableView setFrame:[self.view.frame]]; 

享受

0

只要确保回报是shouldAutorotateToInterfaceOrientation方法,没有如果y需要设置框架我们的类是UITableViewController

// Override to allow orientations other than the default portrait orientation. 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    return YES; 
} 
相关问题