Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode NSTableView-预高亮显示某一行_Xcode_Uitableview_Ios_Row - Fatal编程技术网

Xcode NSTableView-预高亮显示某一行

Xcode NSTableView-预高亮显示某一行,xcode,uitableview,ios,row,Xcode,Uitableview,Ios,Row,嘿,大家好,我有一个表,用户可以选择一个首选的声音,但其中一个应该已经预选 我知道应该预选的行号,但是,我不知道索引号。我怎么才能得到呢 大家干杯,圣诞快乐。NSIndexPath类提供了一个方便的方法来为给定的行和节提供索引:+ 您可以按如下方式使用它: - (void)selectRow:(NSUInteger)rowNum inTableView:(UITableView *)tableView { NSIndexPath * indexPath = [NSIndexPath in

嘿,大家好,我有一个表,用户可以选择一个首选的声音,但其中一个应该已经预选

我知道应该预选的行号,但是,我不知道索引号。我怎么才能得到呢


大家干杯,圣诞快乐。

NSIndexPath类提供了一个方便的方法来为给定的行和节提供索引:+

您可以按如下方式使用它:

- (void)selectRow:(NSUInteger)rowNum inTableView:(UITableView *)tableView
{
    NSIndexPath * indexPath = [NSIndexPath indexPathForRow:rowNum
                                                 inSection:0];
    [tableView selectRowAtIndexPath:indexPath
                           animated:YES
                     scrollPosition:UITableViewScrollPositionMiddle];
}

nsindepath
类提供了一种方便的方法来为给定的行和节提供索引:+

您可以按如下方式使用它:

- (void)selectRow:(NSUInteger)rowNum inTableView:(UITableView *)tableView
{
    NSIndexPath * indexPath = [NSIndexPath indexPathForRow:rowNum
                                                 inSection:0];
    [tableView selectRowAtIndexPath:indexPath
                           animated:YES
                     scrollPosition:UITableViewScrollPositionMiddle];
}

你说的
是什么意思?我知道行号。。不知道索引编号
?您对
索引编号的解释是什么?
?行编号是一个简单的整数,我通过源数组获得。我不知道如何将其转换为索引编号,以便为表视图设置动画。你所说的
是什么意思我知道行编号。。不知道索引编号
?您对
索引编号的解释是什么?
?行编号是一个简单的整数,我通过源数组获得。我不知道如何将其转换为索引号,以便为表视图设置动画。这似乎很完美,但我忽略了提到我是从代理处调用它的。因此,它给了我may not response to+indexPath:forRow:error。不要紧,它成功了,问题是[UITableView indexPathForRow…-正确的实现是[indexPath indexPathForRow:rowNum instation:0];这似乎很完美,但我忽略了提到我是从委托调用它的。因此,它给了我一个可能不响应+indexPath:forRow:error的错误。没关系,它成功了,问题是[UITableView indexPathForRow…-正确的实现是[indexPath indexPathForRow:rowNum-instation:0];