回到表格视图时如何更改UITableViewController的选定单元格? [英] How to change selected cell of UITableViewController when coming back to the table view?

查看:61
本文介绍了回到表格视图时如何更改UITableViewController的选定单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您选择一个单元格并移至详细信息视图并通过点击返回按钮返回到表格视图时,上次选择的单元格的背景颜色将突出显示.

When you select a cell and move to detail view and go back to the table view by tapping back button, the background color of the cell you selected last time is highlighted.

从详细信息视图返回到表格视图时,如何突出显示以前未选择的另一个单元格?

How can I highlight another cell which is not selected before, when coming back to the table view from detail view?

例如,对于苹果公司的 Music 应用程序,当您选择并播放一首歌曲并通过点击下一首曲目按钮来更改歌曲并返回到歌曲表时视图中,突出显示的单元格不是您上次收听的歌曲,而是您在表视图中上次选择的歌曲.
但我想强调一下您上次听过的歌曲.

For example, in case of Apple's Music app, when you select and play a song and change the song by tapping next track button and go back to the song table view, the highlighted cell is not the song you listened last time but the song you selected last time in the table view.
But I want to highlight the song you listened last time.

有可能吗?

推荐答案

在视图中将出现方法,您必须通过以下功能取消选择先前的选择

In view will appear method you have to deselect previous selection with below function

– deselectRowAtIndexPath:animated:

– deselectRowAtIndexPath:animated:

选择之后,您必须调用下面的方法In view将出现

And After that for selection you have to call below method In view will appear

– selectRowAtIndexPath:animated:scrollPosition:

– selectRowAtIndexPath:animated:scrollPosition:

这篇关于回到表格视图时如何更改UITableViewController的选定单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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