![](/img/trans.png)
[英]UITableView - BeginUpdates/EndUpdates Animation Settings
[英]UITableView tableHeaderView crash using beginUpdates/endUpdates settings
當我使用beginUpdates&endUpdates設置UITableView tableHeaderView時,每天在259行代碼中都會發生數十次崩潰:
[self.tableView beginUpdates];
self.tableView.tableHeaderView=self.topView;
[self.tableView endUpdates]; // line 259 crash
以下是崩潰信息:
13 UIKit 0x18fe43090 UIViewAlertForUnsatisfiableConstraints + 66
14 Foundation 0x18a0b94cc -[NSISEngine handleUnsatisfiableRowWithHead:body:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 464
15 Foundation 0x18a099df8 -[NSISEngine tryUsingArtificialVariableToAddConstraintWithMarker:rowBody:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 384
16 Foundation 0x18a0959c4 -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 688
17 Foundation 0x18a0955cc -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 284
18 Foundation 0x18a0931e0 -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 272
19 UIKit 0x18f5ee400 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 396
20 Foundation 0x18a092d10 -[NSISEngine withBehaviors:performModifications:] + 168
21 UIKit 0x18f5ee20c __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 564
22 UIKit 0x18f4eab14 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 224
23 UIKit 0x18f5ee338 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 196
24 Foundation 0x18a092d10 -[NSISEngine withBehaviors:performModifications:] + 168
25 UIKit 0x18f5ee20c __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 564
26 UIKit 0x18f4eab14 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 224
27 UIKit 0x18f62bcf0 -[UIView(AdditionalLayoutSupport) _initializeHostedLayoutEngine] + 460
28 UIKit 0x18f5eb334 -[UIView(AdditionalLayoutSupport) _layoutEngineCreateIfNecessary] + 64
29 UIKit 0x18f5eafc8 -[UIView(UIConstraintBasedLayout) _tryToAddConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 132
30 UIKit 0x18f5eed28 -[UIView(UIConstraintBasedLayout) _updateContentSizeConstraints] + 872
31 UIKit 0x18fe3f1f8 -[UIView(AdditionalLayoutSupport) _updateSystemConstraints] + 116
32 UIKit 0x18f5f05a8 -[UIButton updateConstraints] + 3412
33 UIKit 0x18fe3de80 -[UIView(AdditionalLayoutSupport) _sendUpdateConstraintsIfNecessaryForSecondPass:] + 192
34 UIKit 0x18fe3e1d0 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 632
35 UIKit 0x18fe3e158 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 512
36 UIKit 0x18fe3e158 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 512
37 UIKit 0x18fe3e974 __100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke + 84
38 UIKit 0x18fe3db30 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 136
39 UIKit 0x18fe3e580 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 164
40 UIKit 0x18fe3f58c -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 372
41 UIKit 0x18f500328 -[UIView(Hierarchy) layoutBelowIfNeeded] + 544
42 UIKit 0x18f4fc7dc +[UIView(Animation) performWithoutAnimation:] + 104
43 UIKit 0x18f821b2c __46-[UITableView _updateWithItems:updateSupport:]_block_invoke.996 + 1984
44 UIKit 0x18f5240f0 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 636
只需刪除[self.tableView beginUpdates];
和[self.tableView endUpdates];
您如何在self.topView
上設置約束? 查看堆棧跟蹤,似乎系統無法滿足所有約束。 我將查看topView
並確保所有約束均有效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.