iPhone-已选择单元格移至uitableview的顶部 [英] iPhone - having selected cell move to top of uitableview

查看:65
本文介绍了iPhone-已选择单元格移至uitableview的顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找这个问题,但我不相信我能找到答案.我有一个自定义单元格的表格视图,单击该单元格时,所选单元格将推送一个包含信息的新单元格.我想知道是否有人对如何将选定的单元格推到uitableview的顶部,或使其填充整个tableview有一个想法.

I looked for this problem and I don't believe I could find an answer. I have a tableview of custom cells that when clicked, the selected cell pushes a new cell with information. I was wondering if anyone had an idea of how to push the selected cell to the top of the uitableview, or make it fill up the entire tableview.

我的UITableView只占用了一半的屏幕,我希望在小区被选择,它仅占据屏幕的一半,并在用户仍然能够滚动单元(如果是有道理的)?

My uitableview only takes up half of the screen, and I wish for when the cell is selected that it only take up that half of the screen, and the user is still able to scroll the cell (if that makes sense)?

任何建议将不胜感激,描述我要寻找的东西有些困难,因此,如果有人需要澄清,请随时问我.

Any suggestions would be appreciated, it was somewhat difficult to describe what I am looking for, so if anyone needs clarification please do not hesitate to ask me.

推荐答案

在cellForRowAtIndexPath中,您需要在创建单元格后将其放入其中

in cellForRowAtIndexPath, you need to place this in after you have created your cell

    [tableView scrollToRowAtIndexPath:selectedCellIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];

这对我来说也非常有用,因为它们的自定义高度也是如此.

This did the trick for me with the custom height of the cells as well.

这篇关于iPhone-已选择单元格移至uitableview的顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆