【发布时间】:2013-01-07 22:38:22
【问题描述】:
在我的 tableview 中,我禁用了 portrait 模式下的默认滚动。但是当方向更改为 landscape 模式时,我启用了滚动,以便我可以查看表格的全部内容。但是,当滚动时,在表格视图单元格之前和之后可以看到 空白。那么,谁能告诉我如何在横向模式下删除表格默认滚动视图中的这个空白? 我尝试过使用autoresizingmask,并尝试根据横向模式设置表格的内容大小。两者都没有工作,这是我到目前为止的代码。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
if((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight)){
self.tableView.scrollEnabled = YES;
self.tableView.sectionIndexMinimumDisplayRowCount =5;
self.tableView.contentSize = CGSizeMake(480, 320);
self.tableView.autoresizingMask = YES;
//CGFloat cellHeight;}
else if((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown)){
self.tableView.scrollEnabled = NO;
}
}
【问题讨论】:
-
必须尝试将tableview的背景颜色设置为clearcolor?
标签: iphone objective-c uitableview scroll landscape