iOS:用于访问下一个 Tableview 单元格的按钮 [英] iOS: Button to access next Tableview cell

查看:27
本文介绍了iOS:用于访问下一个 Tableview 单元格的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主视图控制器,它是一个表视图,从表视图中选择一个单元格后,会显示另一个视图.如何创建按钮来访问和显示下一个和上一个单元格的视图?我已经设置了工具栏和按钮,我只需要有关代码的帮助以访问和推送下一个视图.

I have a main view controller which is a tableview, after selecting a cell from the table view, another view is displayed. How can I create buttons to access and display the next and previous cell's view? I have the toolbar and buttons set, I just need help with the code to access and push the next view.

推荐答案

如果您将 tableView 的数据(大概是一个包含单元格信息的数组)传递给您的 detailViewController,然后您就可以通过这种方式浏览项目.

If you pass the data for the tableView (presumably an array containing info for the cells) to your detailViewController, then you can navigate through the items that way.

当您选择一行时,将 indexPath.row 作为属性发送到 detailViewController,例如int selectedRow.然后连接两个按钮,一个减少这个参数,另一个增加它.

When you select a row, send the indexPath.row to the detailViewController as a property, e.g. int selectedRow. Then wire up two buttons, one that decrements this parameter and another that increments it.

这篇关于iOS:用于访问下一个 Tableview 单元格的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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