0
正在我的tableview中使用自定義單元格與背景圖像。當方向更改單元格大小未發生變化時,我需要在方向更改時自動更改自定義單元格大小。如何實現此目的?更改UItableview自定義單元格的寬度
正在我的tableview中使用自定義單元格與背景圖像。當方向更改單元格大小未發生變化時,我需要在方向更改時自動更改自定義單元格大小。如何實現此目的?更改UItableview自定義單元格的寬度
您可以委託編程設定的tableview框架 -
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
您可以使用
[tableView setFrame:[self.view.frame]];
享受
只要確保回報是在shouldAutorotateToInterfaceOrientation方法,沒有如果y需要設置框架我們的類是UITableViewController。
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;
}
如果你用xib創建u cell然後使用autoresize。另外明智地設置框架 – Ron 2012-01-18 04:52:27