Ios 在UITableview滚动后,按页脚上的视图
我有一个tableview,我向下滚动,数组数据出现,如果数组没有数据,滚动后想在视图的底部出现一个视图Ios 在UITableview滚动后,按页脚上的视图,ios,objective-c,iphone,Ios,Objective C,Iphone,我有一个tableview,我向下滚动,数组数据出现,如果数组没有数据,滚动后想在视图的底部出现一个视图 -(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { NSInteger totalRow = [tableView numberOfRowsInSection:indexPath.s
-(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger totalRow = [tableView numberOfRowsInSection:indexPath.section];//first get total rows in that section by current indexPath.
if(indexPath.row == totalRow -1){
[self.tableViewMesages setFrame:CGRectMake(0.0, 65.0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height-115.0)];
[self.footer setFrame:CGRectMake(0.0,[UIScreen mainScreen].bounds.size.height-55, [UIScreen mainScreen].bounds.size.width,55.0)];
self.imgvwSmily.alpha=1;
[self.footer addSubview:self.imgvwSmily];
}
else
{
[self.tableViewMesages setFrame:CGRectMake(0.0, 65.0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height-65.0)];
[self.footer setFrame:CGRectMake(0.0,[UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width,55.0)];
self.imgvwSmily.alpha=0;
[self.footer addSubview:self.imgvwSmily];
}
}
我用这个密码试过了
您可以添加页脚视图。您的页脚视图将在
数组中没有任何要显示的数据,您已到达数组的底部
UtableView
看看如何在下面链接的UITableview中添加页脚视图
我希望这可能有助于解决你的问题
谢谢欢迎来到Stack Overflow!请特别查看帮助中心。你被卡在哪一部分?您尝试了什么?您是否可以显示您想要添加的视图,该视图将显示在所有数据单元格下?您可以使用页脚或其他单元格来实现这一点。@kelin不喜欢在所有数据之后显示主视图底部的视图,而不是在tableview中。谢谢。我的问题是,我有10个数据,我在tableview上列出,滚动tableview后,10个数据列出了一个视图,希望从底部来,并说像没有更多data@ManjuS:是的,您只需要添加页脚视图。不管你有10张唱片还是50张,这都无关紧要。当tableview到达底部时,您将能够看到页脚视图。试着从例子中整合。为页脚视图提供背景色。