如何使特定的 UITableViewCell 在屏幕上可见,同时在 UITableView 中有更多行 [英] How to make specific UITableViewCell to be visible on screen while having more rows in UITableView
问题描述
我在表视图中有 20 行,我在屏幕的一半(使用 IB)设计(或说调整了大小)UITableView,在一半屏幕中我展示了与特定 UITableViewCell 相关的东西.哪个单元格的详细信息将显示在半屏中由运行时间决定.我希望在加载第二个单元格的视图时单元格可见.
I am having 20 rows in a table view, and I have designed (or say resized) UITableView in half of the screen (Using IB) and in half screen I am showing the stuff related to particular UITableViewCell. Which cell's details are going to be shown in the half screen is decided runtime. I want the cell being visible while loading the view for say second last cell.
我怎样才能做到这一点?
How can I achieve this?
推荐答案
UITableView
类提供:
-(void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath
atScrollPosition:(UITableViewScrollPosition)scrollPosition
animated:(BOOL)animated;
这似乎是您要找的东西.
which seems to be what you are looking for.
NSIndexPath
可以使用以下方法构建对象:
The NSIndexPath
object can be built using :
+(NSIndexPath *)indexPathForRow:(NSInteger)row inSection:(NSInteger)section;
这篇关于如何使特定的 UITableViewCell 在屏幕上可见,同时在 UITableView 中有更多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!