Iphone 返回正确大小的页脚时,UITableView在节页脚中随机显示白线
我在从NIB创建的视图中有一个UITableView。该表有一个包含6行和1页脚的部分。当我使用:Iphone 返回正确大小的页脚时,UITableView在节页脚中随机显示白线,iphone,objective-c,uitableview,Iphone,Objective C,Uitableview,我在从NIB创建的视图中有一个UITableView。该表有一个包含6行和1页脚的部分。当我使用: - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return 80; } 返回从同一笔尖加载的页脚高度。nib中的UITableViewCell的高度为80。UITableViewCells是使用以下代码分配的: - (UITableViewCell *)
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 80;
}
返回从同一笔尖加载的页脚高度。nib中的UITableViewCell的高度为80。UITableViewCells是使用以下代码分配的:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section==0){
if(indexPath.row==0){
返回公司电话;
}
if(indexath.row==1){
返回firstNameCell;
}
if(indexPath.row==2){
返回lastNameCell;
}
if(indexPath.row==3){
返回电子邮件单元;
}
if(indexPath.row==4){
返回密码单元;
}
if(indexPath.row==5){
返回密码确认单元;
}
}
我的桌子底部有一条白线,如图所示
如果返回页脚高度79或81,则白线消失,UITableViewCell将缩放到窗口的宽度
有什么想法吗?就高度而言,您是否尝试过更多类似这样的行操作
- (CGFloat)tableView:(UITableView *) theTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
Question *question = [self.questions objectAtIndex:row];
NSString *theText = question.description;
UIFont *font = [UIFont fontWithName:@"Helvetica" size:14.0]; // You can choose a different font ofcourse.
int heightExtra = 0;
if (selectedIndexSegment == 0){
heightExtra = 54;
}
if (selectedIndexSegment == 1) {
heightExtra = 24;
}
CGSize withinsize = CGSizeMake(theTableView.frame.size.width -60, 1000); //1000 is just a large number. could be 500 as well
// You can choose a different Wrap Mode of your choice
CGSize sz = [theText sizeWithFont:font constrainedToSize:withinsize lineBreakMode:UILineBreakModeWordWrap];
return sz.height + heightExtra; // padding space of 20 should be fine!
}
还有呢
self.tableView.separatorColor = [UIColor clearColor];
希望对您有所帮助……在高度方面,您是否尝试过更多类似这样的行操作
- (CGFloat)tableView:(UITableView *) theTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
Question *question = [self.questions objectAtIndex:row];
NSString *theText = question.description;
UIFont *font = [UIFont fontWithName:@"Helvetica" size:14.0]; // You can choose a different font ofcourse.
int heightExtra = 0;
if (selectedIndexSegment == 0){
heightExtra = 54;
}
if (selectedIndexSegment == 1) {
heightExtra = 24;
}
CGSize withinsize = CGSizeMake(theTableView.frame.size.width -60, 1000); //1000 is just a large number. could be 500 as well
// You can choose a different Wrap Mode of your choice
CGSize sz = [theText sizeWithFont:font constrainedToSize:withinsize lineBreakMode:UILineBreakModeWordWrap];
return sz.height + heightExtra; // padding space of 20 should be fine!
}
还有呢
self.tableView.separatorColor = [UIColor clearColor];
希望能有帮助…我想出来了!!我正在将UITableViewCell的一个实例传递给页脚。我已经更新了我的代码,只通过UIView,问题已经解决了 我想出来了!!我正在将UITableViewCell的一个实例传递给页脚。我已经更新了我的代码,只通过UIView,问题已经解决了 对不起,上面的代码格式错误。当我输入stackoverflow时,它提供了一个正确的预览。此外,81px页脚的图像对于上面的代码格式错误表示抱歉。stackoverflow在我输入它时提供了一个正确的预览;也从表中删除所有分隔符。self.tableView.separatorColor=[UIColor clearColor];也从表中删除所有分隔符。