我需要在messages.app中创建uitableview。从CoreData通过NSFetchedResultsController加载数据。
我找到了最简单的方法,实际上我没有在google中找到这种方法:)
魔法代码:
对于UITableView和UITableViewCell:
CGAffineTransform transform1 = CGAffineTransformMakeRotation(M_PI);
tableView.transform = CGAffineTransformScale(transform1, -1.0, 1.0);
然后我使用自定义“标题”,但因为我们的UITableView被镜像并旋转它将是页脚:
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 0;
}
- (CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 20.0;
}
- (UIView *) tableView:(UITableView *)tableVie viewForFooterInSection:(NSInteger)section {
MessagesSectionHeaderView *vieww = [[MessagesSectionHeaderView alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];
vieww.text = [self tableView:tableVie titleForHeaderInSection:section];
return vieww;
}
它就像一个没有任何动画麻烦的魅力。
但是。当我这样做时会有什么麻烦?也许滚动速度较慢?
答案 0 :(得分:0)
没有麻烦。转换不应该影响滚动。
我发现这个解决方案有点hacky,因为没有必要旋转表视图以获得反向滚动效果。但如果它适合你,那就去吧!