ASCollectionNode показывает VerticScrollIndicator - это точечная работа
Я использую AsyncDisplayKit ASCollectionView, но он не показывает VerticalScrollIndicator = NO, не может работать? Кто может сказать мне, спасибо
self.collectionNode = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout];
self.collectionNode.dataSource = self;
self.collectionNode.delegate = self;
self.collectionNode.view.showsVerticalScrollIndicator = NO;
// this can't working
Debug:
2018-03-12 10:04:37.255867+0800 LiveTeach-iPhone[29773:17126525] [Node] View controller <LTProcessViewController: 0x7f99e365ff90> will appear
2018-03-12 10:04:37.270323+0800 LiveTeach-iPhone[29773:17126525] [Collection] performBatchUpdates <ASTableNode: 0x7f99e3681410> { }
2018-03-12 10:04:37.270649+0800 LiveTeach-iPhone[29773:17126525] [Collection] <ASTableView: 0x7f99e4083c00> Skipped update because load hasn't happened.
2018-03-12 10:04:37.272763+0800 LiveTeach-iPhone[29773:17126525] [Collection] Initial reloadData <ASTableNode: 0x7f99e3681410>
2018-03-12 10:04:37.282165+0800 LiveTeach-iPhone[29773:17126525] [Collection] New content: { itemCounts = [ <S0: 40> ] }
2018-03-12 10:04:37.296018+0800 LiveTeach-iPhone[29773:17126665] *** Assertion failure in -[ASCollectionNode view], /Users/vvv/Desktop/liveTeach/vvv-iphone/Pods/Texture/Source/ASDisplayNode.mm:679
2018-03-12 10:04:37.296049+0800 LiveTeach-iPhone[29773:17126681] *** Assertion failure in -[ASCollectionNode view], /Users/xxx/Desktop/liveTeach/xxx-iphone/Pods/Texture/Source/ASDisplayNode.mm:679
2018-03-12 10:04:37.296076+0800 LiveTeach-iPhone[29773:17127565] *** Assertion failure in -[ASCollectionNode view], /Users/xxx/Desktop/liveTeach/xxx-iphone/Pods/Texture/Source/ASDisplayNode.mm:679
2018-03-12 10:04:37.296095+0800 LiveTeach-iPhone[29773:17126669] *** Assertion failure in -[ASCollectionNode view], /Users/xxx/Desktop/liveTeach/xxx-iphone/Pods/Texture/Source/ASDisplayNode.mm:679
2018-03-12 10:04:37.296113+0800 LiveTeach-iPhone[29773:17126680] *** Assertion failure in -[ASCollectionNode view], /Users/xxx/Desktop/liveTeach/xxx-iphone/Pods/Texture/Source/ASDisplayNode.mm:679
2018-03-12 10:04:37.296131+0800 LiveTeach-iPhone[29773:17127564] *** Assertion failure in -[ASCollectionNode view], /Users/xxx/Desktop/liveTeach/xxx-iphone/Pods/Texture/Source/ASDisplayNode.mm:679
2018-03-12 10:04:37.296153+0800 LiveTeach-iPhone[29773:17127563] *** Assertion failure in -[ASCollectionNode view], /Users/xxx/Desktop/liveTeach/xxx-iphone/Pods/Texture/Source/ASDisplayNode.mm:679
2018-03-12 10:04:37.296174+0800 LiveTeach-iPhone[29773:17127562] *** Assertion failure in -[ASCollectionNode view], /Users/xxx/Desktop/liveTeach/xxx-iphone/Pods/Texture/Source/ASDisplayNode.mm:679
2018-03-12 10:04:37.305469+0800 LiveTeach-iPhone[29773:17126525] [Node] Propagating new traits for <LTProcessViewController: 0x7f99e365ff90>: { userInterfaceIdiom = Phone; containerSize = {414, 687}; horizontalSizeClass = Compact; verticalSizeClass = Regular; forceTouchCapability = Available }
2018-03-12 10:04:37.305984+0800 LiveTeach-iPhone[29773:17126525] [Node] Propagating new traits for <LTProcessViewController: 0x7f99e365ff90>: { userInterfaceIdiom = Phone; containerSize = {414, 687}; horizontalSizeClass = Compact; verticalSizeClass = Regular; forceTouchCapability = Available }
2018-03-12 10:04:37.353424+0800 LiveTeach-iPhone[29773:17127563] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This method must be called on the main thread'
*** First throw call stack:
(
0 CoreFoundation 0x000000010a7e112b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010f1e5f41 objc_exception_throw + 48
2 CoreFoundation 0x000000010a7e62f2 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010b637d69 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 LiveTeach-iPhone 0x000000010931bb51 -[ASDisplayNode view] + 1009
5 LiveTeach-iPhone 0x000000010929ba56 -[ASCollectionNode view] + 54
6 LiveTeach-iPhone 0x00000001090c14c6 -[LTProcessCellView initWithModel:] + 2758
7 LiveTeach-iPhone 0x00000001090a9807 __64-[LTProcessViewController tableNode:nodeBlockForRowAtIndexPath:]_block_invoke + 71
8 LiveTeach-iPhone 0x0000000109414748 __51-[ASTableView dataController:nodeBlockAtIndexPath:]_block_invoke_2 + 104
9 LiveTeach-iPhone 0x000000010928599f -[ASCollectionElement node] + 127
10 LiveTeach-iPhone 0x00000001092d360a __58-[ASDataController _allocateNodesFromElements:completion:]_block_invoke + 154
11 LiveTeach-iPhone 0x00000001092e55ad __ASDispatchApply_block_invoke + 93
12 libdispatch.dylib 0x0000000110ea12f7 _dispatch_call_block_and_release + 12
13 libdispatch.dylib 0x0000000110ea233d _dispatch_client_callout + 8
14 libdispatch.dylib 0x0000000110ea7406 _dispatch_queue_override_invoke + 1895
15 libdispatch.dylib 0x0000000110eae102 _dispatch_root_queue_drain + 772
16 libdispatch.dylib 0x0000000110eadda0 _dispatch_worker_thread3 + 132
17 libsystem_pthread.dylib 0x000000011136d1ca _pthread_wqthread + 1387
18 libsystem_pthread.dylib 0x000000011136cc4d start_wqthread + 13
)
это отладочное сообщение, но я не могу это исправить。 кто может мне помочь, большое спасибо
1 ответ
ASDisplayNode - это класс Async, вы не можете просто вызвать свойство view напрямую, вы должны подождать, когда оно будет загружено. А в ASDisplayNode есть метод для его перезаписи с помощью подкласса `-(void)didLoad;' или блок для логики загрузки непосредственно в Node (как в вашем случае):
[self.collectionNode onDidLoad:^(__kindof ASCollectionNode *node) {
node.view.showsVerticalScrollIndicator = NO;
}];
И didLoad должен вызываться на MainThread, не помню, но я думаю, что didLoad вызывается на Main по умолчанию, нужно проверить это.