繁体   English   中英

UICollectionView滚动崩溃

[英]UICollectionView crash on scroll

我试图使用Flow Layout创建一个UICollectionView。 单元格暂时只是文本标签。 单元格的第一个屏幕显示得很好,但是当我尝试滚动时,模拟器崩溃了。 调试器显示以下消息:

(lldb) thread backtrace
  * thread #1: tid = 0x39235a, 0x008440b2 libobjc.A.dylib`objc_msgSend + 14, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xa000000c)
  * frame #0: 0x008440b2 libobjc.A.dylib`objc_msgSend + 14
    frame #1: 0x01ab9b30 UIKit`-[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 257
    frame #2: 0x01abb775 UIKit`-[UICollectionView _updateVisibleCellsNow:] + 4730
    frame #3: 0x01abf65f UIKit`-[UICollectionView layoutSubviews] + 265
    frame #4: 0x014e2964 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
    frame #5: 0x0084682b libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
    frame #6: 0x0280e45a QuartzCore`-[CALayer layoutSublayers] + 148
    frame #7: 0x02802244 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 380
    frame #8: 0x028020b0 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
    frame #9: 0x027687fa QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 294
    frame #10: 0x02769b85 QuartzCore`CA::Transaction::commit() + 393
    frame #11: 0x0276a258 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
    frame #12: 0x02bd936e CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    frame #13: 0x02bd92bf CoreFoundation`__CFRunLoopDoObservers + 399
    frame #14: 0x02bb7254 CoreFoundation`__CFRunLoopRun + 1076
    frame #15: 0x02bb69d3 CoreFoundation`CFRunLoopRunSpecific + 467
    frame #16: 0x02bb67eb CoreFoundation`CFRunLoopRunInMode + 123
    frame #17: 0x05f5b5ee GraphicsServices`GSEventRunModal + 192
    frame #18: 0x05f5b42b GraphicsServices`GSEventRun + 104
    frame #19: 0x01473f9b UIKit`UIApplicationMain + 1225
    frame #20: 0x0002423c 8actions`main(argc=1, argv=0xbfffe610) + 156 at main.mm:15

我正在使用最新版本的rubymotion,并将IOS Simulator设置为带有IOS 7.1的iPhone 4英寸。 我正在使用的代码可以在这里找到:

https://gist.github.com/jhmegorei/42c15038a34971ac5e8e

注意:我不想使用CollectionViewController,因为我要求集合View只是可以添加到普通UIView的另一个view元素。

如果有人可以帮助我调查这次崩溃的根本原因,我将非常高兴:)

要点中没有“ MemoListViewDelegate.rb”。 您是说“ MemoListDataSource.rb”吗?

另外,我想你是说你改变了

  list_view.dataSource       = MemoListDatasource.new

  list_view.dataSource       = self

以及在其中移动数据源方法。

您是否进行了其他更改以使其正常工作?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM