- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个类,允许用户将条目添加到服务器端表。一切正常,直到我尝试刷新 UITableView
与新数据。我调用服务器来获取新数据集,用它来刷新 NSArray
那是表的数据源,然后尝试重新加载表。这是从服务器返回数据时调用的方法:
- (void) logEntriesRefreshed : (NSNotification *) notification {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:@"log_entries_refreshed"
object:nil];
NSLog(@"returned from log entries fetch");
_logEntriesArray = [LogEntriesDataFetcher getLogEntriesArray];
[_tableView reloadData];
_activityIndicator.hidden = YES;
[_activityIndicator stopAnimating];
NSLog(@"log entries array count: %lu", [_logEntriesArray count]);
[_tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]
animated:NO
scrollPosition:UITableViewScrollPositionNone];
}
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"here");
UITableViewCell *previousCell = (UITableViewCell *)[_tableView cellForRowAtIndexPath:_previousIndexPath];
previousCell.backgroundColor = [UIColor clearColor];
previousCell.textLabel.textColor = [SharedVisualElements primaryFontColor];
UITableViewCell *cell = (UITableViewCell *)[_tableView cellForRowAtIndexPath:indexPath];
cell.contentView.backgroundColor = [SharedVisualElements secondaryFontColor];
cell.textLabel.textColor = [SharedVisualElements primaryFontColor];
_previousIndexPath = indexPath;
// get the file attributes for the cell just selected
_currentEntry = (LogEntry *)[_logEntriesArray objectAtIndex:[indexPath row]];
NSLog(@"array count: %lu", (unsigned long)[_logEntriesArray count]);
NSLog(@"current entry: %ld", (long)[indexPath row]);
_isExistingEntry = YES;
_arrayPositionOfEntryBeingEdited = [indexPath row];
[self initializeValues];
[self initializeObjects];
[self captureStartingValuesForStateMachine];
}
selectRowAtIndexPath
上设置了断点行和第一个
NSLog(@"here")
输入
didSelectRow...
.我到达
selectRowAtIndexPath
行,但从不到
didSelectRow
方法。我的控制台输出与此一致:
returned from log entries fetch
log entries array count: 7
didSelectRow...
中没有任何内容方法。也没有抛出错误。
最佳答案
根据 Apple 的文档,调用 selectRowAtIndexPath
不会调用 didSelectRowAtIndexPath
.看看here .
Calling this method does not cause the delegate to receive a tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath: message, nor does it send UITableViewSelectionDidChangeNotification notifications to observers.
didSelectRowAtIndexPath
委托(delegate)方法,使用以下代码:
[[tableView delegate] tableView:tableView didSelectRowAtIndexPath:indexPath];
关于ios - 未调用 selectRowAtIndexPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32076443/
我有一个类,允许用户将条目添加到服务器端表。一切正常,直到我尝试刷新 UITableView与新数据。我调用服务器来获取新数据集,用它来刷新 NSArray那是表的数据源,然后尝试重新加载表。这是从服
我正在尝试以编程方式选择 TableView 行。我一直在关注此处的文档和其他引用资料,但它不起作用。我没有收到错误,只是没有选择行。 注意:目前我只是尝试手动选择一行。 我是否正确使用了委托(del
我觉得这是一个需要特别注意的问题......我的Google-fu很好,但我还没有得到任何有用的东西。 这是最简单的事情,但我似乎无法弄清楚它的问题所在。 我有一个 UITableView。这是我的
我用 [tableView selectRowAtIndexPath:index animated:YES scrollPosition:UITableViewScrollPositionMiddle
I've got a menu that's a UITableview in a UIPopovercontroller that when selected scrolls the parent
我有大约 80 件元素。如果我选择的索引是 15(或更小的值),它会滚动到正确的位置。但如果选择索引为 70,则它不会滚动。但是当我手动滚动时它选择了该行。有谁知道如何解决这个问题? -(void)s
我正在尝试使用 selectRowAtIndexPath 强制选择(突出显示)UITableViewCell.. 例如,可以说我希望始终突出显示 TableView 中的第一个单元格,我在 viewD
我有以下方法来选择当前中心 View Controller 的行: - (void)_updateSelection { [self.tableView reloadData]; [_
我想调用 selectRowAtIndexPath 在作为 UIViewController 的 subview 的 UITableView 上,我从中调用它。 我已经设置了它,这样当你选择一个单元格
我有一个 UITableViewCell 的子类,它给我自定义样式和额外数据。 当用户交互时一切正常,但是当我通过调用 selectRowAtIndexPath 以编程方式选择它时,它会恢复为标准选择
我正在尝试使用以下代码以编程方式选择 TableView 中的所有行: func tableView(tableView: UITableView, cellForRowAtIndexPath in
背景:我正在尝试实现一个可以折叠和展开的分段表格 View 。折叠时,表格会记住选择的内容并在展开时保留选择状态。 问题:a 部分已扩展并正常运行。该单元格已按应有的方式被选中。但是,位于同一位置但下
我有一个 UITableViewController,它根据用户之前的选择动态填充。在某些情况下,用户应该能够选择表中的多行,但在其他情况下他不应该。在这两种情况下,我都想自动选择第一行,但我发现只有
我经常需要将表格 View 单元格设置为初始选定状态,对此我使用以下代码: [self.tableView selectRowAtIndexPath:indexPath animated:NO
我正在尝试以编程方式在表格 View 中选择一个单元格。我在点击 selectRowAtIndexPath 时收到 SIGABORT 错误。 myIndex 的值为 1。我从已实现所需的 tablev
我正在制作自定义 UITableView 菜单选择器组件。每次我选择特定的行时,我都会保存该行的索引路径,这样下次用户选择另一行时,人们就可以知道他之前选择的行。所以我将其添加到 cellForRow
我在 tableView:didSelectRowAtIndexPath: 中有以下代码 [tableView reloadData]; [tableView selectRowAtIndexPath
我是一名优秀的程序员,十分优秀!