【发布时间】:2016-01-28 08:46:21
【问题描述】:
我有一个带有可展开/可折叠部分的表格视图。它在 iOS 8 中运行良好,但在 iOS 9 中的 reloadSections 时崩溃。这是代码:
NSRange range = NSMakeRange(selectedSection, 1);
[_tableView reloadSections:[NSIndexSet indexSetWithIndexesInRange:range] withRowAnimation:UITableViewRowAnimationAutomatic];
我已经查看了这个问题,似乎有些人遇到了它,但没有一个解决方案对我有用。当然我可以重新加载表格,但这不会给我动画的外观,我只是不希望整个表格视图重新加载。这是我唯一的日志(通过控制台上的 bt 命令):
thread #1: tid = 0xfecd, 0x25be16aa UIKit__46-[UITableView _updateWithItems:updateSupport:]_block_invoke + 98, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xfffffffc)
frame #0: 0x25be16aa UIKit__46-[UITableView _updateWithItems:updateSupport:]_block_invoke + 98
frame #1: 0x25d074fc UIKit__46-[UITableView _updateWithItems:updateSupport:]_block_invoke1011 + 184
frame #2: 0x25be10b4 UIKit-[UITableView _updateWithItems:updateSupport:] + 2348
frame #3: 0x25bc5684 UIKit-[UITableView _endCellAnimationsWithContext:] + 10648
frame #4: 0x25bc2b5a UIKit-[UITableView _updateSections:updateAction:withRowAnimation:headerFooterOnly:] + 434
frame #5: 0x25bc299e UIKit`-[UITableView reloadSections:withRowAnimation:] + 38
frame #6: 0x0028d956 MyAPP-[MyView expandCollapseSection:](self=0x16f90170, _cmd=0x0096e193, sender=0x16fec2d0) + 1230 at MyView.m:256
frame #7: 0x25a09770 UIKit-[UIApplication sendAction:to:from:forEvent:] + 80
frame #8: 0x25a09700 UIKit-[UIControl sendAction:to:forEvent:] + 64
frame #9: 0x259f161e UIKit-[UIControl _sendActionsForEvents:withEvent:] + 446
frame #10: 0x25a09050 UIKit-[UIControl touchesEnded:withEvent:] + 616
frame #11: 0x259c2fc6 UIKit_UIGestureRecognizerUpdate + 10934
frame #12: 0x25a01e10 UIKit-[UIWindow _sendGesturesForEvent:] + 904
frame #13: 0x25a015c2 UIKit-[UIWindow sendEvent:] + 622
frame #14: 0x259d2118 UIKit-[UIApplication sendEvent:] + 204
frame #15: 0x259d0756 UIKit_UIApplicationHandleEventQueue + 5134
frame #16: 0x217fd256 CoreFoundation__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
frame #17: 0x217fce46 CoreFoundation__CFRunLoopDoSources0 + 454
frame #18: 0x217fb1ae CoreFoundation__CFRunLoopRun + 806
frame #19: 0x2174dbb8 CoreFoundationCFRunLoopRunSpecific + 516
frame #20: 0x2174d9ac CoreFoundationCFRunLoopRunInMode + 108
frame #21: 0x229c7af8 GraphicsServicesGSEventRunModal + 160
frame #22: 0x25a39fb4 UIKitUIApplicationMain + 144
frame #23: 0x0009a1ec MyAppmain(argc=1, argv=0x0108bb24) + 108 at main.m:17
我曾尝试使用更新块 (beginUpdates) 和动画块,但徒劳无功。 任何帮助表示赞赏。
【问题讨论】:
标签: ios objective-c uitableview ios9