我在我的项目中使用自定义 UITableView
来显示数据它工作正常但是当我尝试将它滚动到底部时它不会在所需的单元格处停止它总是跳到表格的顶部.只显示 2-3 个单元格。
请建议添加什么来克服这个问题。
我尝试了很多在类似问题中回答的代码,但它们不起作用
我为 UITableView
使用以下代码
newsFeedTable = [[UITableView alloc]init];
CGFloat Ytablepadding = CGRectGetMaxY(homeView.frame)+60;
CGFloat heighttable = 700;
newsFeedTable.frame = CGRectMake(0,Ytablepadding, self.view.frame.size.width, heighttable);
[self.view addSubview:newsFeedTable];
newsFeedTable.delegate=self;
newsFeedTable.dataSource= self;
最佳答案
在你的 viewDidload 中添加这段代码:
NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:AddYourLastIndex inSection:0];
[self.tbl_presentation selectRowAtIndexPath:myIndexPath animated:YES scrollPosition:UITableViewScrollPositionBottom];
关于IOS- UITableView 滚动回到顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32710836/