获取 UITableView 的选定索引 [英] Get Selected index of UITableView

查看:31
本文介绍了获取 UITableView 的选定索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为 UITableView 选择索引.我写了以下代码:

I want to have selected index for UITableView. I have written following code:

NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
[tableView scrollToRowAtIndexPath:index 
                 atScrollPosition:UITableViewScrollPositionTop 
                         animated:YES];

这始终适用于第一项.我想在 indexPathForRow 中选择索引.

This always work for 1st item. I want to have selected index in indexPathForRow.

请帮忙.谢谢.

推荐答案

NSIndexPath *selectedIndexPath = [tableView indexPathForSelectedRow];

这篇关于获取 UITableView 的选定索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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