iOS模拟器问题?

标签 ios objective-c ios-simulator

我正在尝试教程:从 RoadMapiOS 添加数据 https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/index.html

事件似乎没有及时触发。第一个事件仅在三次点击后调用。然后每个事件都落后一次。有时它似乎落后了两个。

- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath{

    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    NSLog(@"%d", (indexPath.row));
    XYZToDoItem *tappedItem = [self.toDoItems objectAtIndex:indexPath.row];
    tappedItem.completed = !tappedItem.completed;
    [tableView reloadRowsAtIndexPaths:@[indexPath]
                     withRowAnimation:UITableViewRowAnimationNone];
}

当我使用调试器逐步执行此操作时。

Click on        Console output
-------------------------------
Row 5           -
Row 3           4
Row 1           2
Row 3           0

索引从 0 开始,但似乎与上一个事件匹配。这只是模拟器的问题还是可能配置错误?

最佳答案

查看链接,我认为您的功能有误。您有 *de*selectRowAtIndexPath 而不是 *did*SelectRowAtIndexPath。这就是为什么它被称为“迟到”的原因,因为当您按预期选择时它不会被调用,但是当您选择下一行时,它会为先前选择的行触发。

尝试:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

关于iOS模拟器问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21103783/

相关文章:

ios - iPhone 6/6 Plus 模拟器是否支持更改 Display Zoom 模式?

ios - Xcode 未使用 XCFrameworks 找到架构 x86_64 的符号

c++ - iOS NAT64 IPv6 环境问题

iOS 应用程序 AdColony 框架错误的视频方向

iphone - 为什么 XCode 静态分析器无法检测到未发布的保留属性?

objective-c - Xcode 4.5.2 - OS X 应用程序 - 将 webview 链接到代码,加载手动编码的主页

ios - iOS上的Twitter-如何授予发布推文的权限?

ios - 如何在 iOS 中创建带有阴影和 subview 的 UIimageView

ios - 显示结果后关闭 UISearchBar

ios - react native axios 请求在 IOS 模拟器中不起作用