Iphone 一个UITableview,偶尔在最后一条记录下方加载空白
我有一个Iphone 一个UITableview,偶尔在最后一条记录下方加载空白,iphone,ios,objective-c,uitableview,Iphone,Ios,Objective C,Uitableview,我有一个UITableview,它偶尔会在最后一条记录下面加载空白。在下面的屏幕截图示例中,只返回了9个结果,表应该在最后一行结束。相反,表中有相当多的滚动空白。如果我再重新装填桌子,那就又好了。这种情况很少发生,我不知道问题出在哪里 仅当通过选择表行从该视图控制器移动到详图视图时,才会发生这种情况。当您返回到第一个vc和表时,空白就在那里 下面是它的屏幕截图: 有9个结果。我滚动到9个结果的末尾(底部的黑色矩形是第9行),然后是下面的空白。您可以看到滚动条上有多少空白 下面是我创建单元格的方
UITableview
,它偶尔会在最后一条记录下面加载空白。在下面的屏幕截图示例中,只返回了9个结果,表应该在最后一行结束。相反,表中有相当多的滚动空白。如果我再重新装填桌子,那就又好了。这种情况很少发生,我不知道问题出在哪里
仅当通过选择表行从该视图控制器移动到详图视图时,才会发生这种情况。当您返回到第一个vc和表时,空白就在那里
下面是它的屏幕截图:
有9个结果。我滚动到9个结果的末尾(底部的黑色矩形是第9行),然后是下面的空白。您可以看到滚动条上有多少空白
下面是我创建单元格的方式:
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableCell";
tableCell *cell = (tableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"tableCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.selectedBackgroundView = [[UIView alloc] initWithFrame:CGRectZero];
cell.selectedBackgroundView.backgroundColor = [UIColor colorWithRed:204.0/255.0 green:56.0/255.0 blue:55.0/255.0 alpha:1];
cell.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrowDisclosure.png"]];
cell.descriptionLabel.numberOfLines = 0;
[cell.titleLabel setFont:[UIFont fontWithName: @"Asap-Bold" size: 15.0f]];
[cell.descriptionLabel setFont:[UIFont fontWithName: @"Asap-Regular" size: 10.0f]];
[cell.priceDealLabel setFont:[UIFont fontWithName: @"Asap-Bold" size: 15.0f]];
[cell.oldPriceDealLabel setFont:[UIFont fontWithName: @"Asap-Bold" size: 8.0f]];
[cell.discountDealLabel setFont:[UIFont fontWithName: @"Asap-Bold" size: 12.0f]];
[cell.ratingsNumberLabel setFont:[UIFont fontWithName: @"Asap-Regular" size: 9.0f]];
[cell.amountLabel setFont:[UIFont fontWithName: @"Asap-Regular" size: 9.0f]];
}
它发生在执行搜索后,触摸一行以移动到详细视图,然后返回到表视图时,空白就在那里
我有这个。看起来两种键盘方法的帧代码相同。是吗
-(void) keyboardShown:(NSNotification *)note {
CGRect keyboardFrame;
[[[note userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardFrame];
CGRect tableViewFrame = self.tableView.frame;
tableViewFrame.size.height -= keyboardFrame.size.height;
[self.tableView setFrame:tableViewFrame];
self.tableView.frame = CGRectMake(0, 100,320, 333); // displaying results after keyboard shown.
}
-(void)keyboardHidden:(NSNotification *)note {
self.tableView.frame = CGRectMake(0, 100,320, 333); // displaying results after keyboard is hidden.
}
您应该发布一些代码,以便人们可以帮助您。如何在tableview中加载数据?您是否修改了tableView的
contentSize
?黑色区域是什么?白色区域是表视图,对吗?@MeeraJPai是的,黑色区域只是最后一行,是第8行的1/3。白色是tableview的其余部分。能否提供用于tableview的委托方法?