如何将uitableview选择与indexpath值居中
我正在保存子视图中的 indexPath 选择,并使用委托将其传递到父视图。当我从主视图返回子视图时,我将 indexPath 传递回它,并向用户显示他们之前在 tableviewcell 的附件视图中选择的单元格。
一个问题是,如果用户从相当大的列表中选择了一个单元格,则很难找到他们再次选择的单元格,以防他们想要更改它(因为他们犯了一个错误)
我想知道他们是否是一种方法使用indexPath或类似的东西将uitableview的先前选择的单元格居中到屏幕的中心?
更新::
这是我试图实现的图形视图,以使其更容易理解。
第一步:选择单元格,然后转到子视图并选择要传递回主视图的单元格(值)(保存indexPath)所选单元格的)
第二步:用户要么想要更改他的选择,要么犯了一个错误,需要选择下面的单元格他们选择的那个...重复前面的步骤,但在视图中心显示先前选择的单元格。
I am saving the indexPath selection from a subview and passing it to the parent view with delegates. When I got back to my subview from my main view I pass the indexPath back to it and show the user which cell they previously selected with a tick in the accessory view of the tableviewcell.
One problem being if the user has selected a cell out of a fairly big list its hard to find the cell they selected again incase they wanted to change it (being that they made a mistake)
I would like to know if their is a way to use indexPath or something similar to center the previously selected cell of the uitableview to the center of the screen?
UPDATE::
Here is a graphical view of what I am trying to achive to make it abit more understandable..
step one : select cell then go to subview and select the cell (value) you want to pass back to main view (save indexPath of selected cell)
step two: user either wants to change his selection or made a mistake and was ment to select the cell below the one they chose... repeat previous steps but display previously selected cell in the center of the view..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过以下功能
Have you tried the following function
UITableView 是 UIScrollView 的子类 - 尝试设置内容偏移量(通过单元格高度和索引路径计算出多少)。
应该有效。您可能想要稍微不同地进行数学计算。
a UITableView is a subclass of UIScrollView - try setting the Content Offset (figure out how much with the cell height and indexPath).
should work. You might want to do the math a little differently.