From aefb40bf93e880dd31aa32d34f88204d83209303 Mon Sep 17 00:00:00 2001 From: sdaheng Date: Thu, 17 Dec 2015 13:36:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8EStackView=E4=B8=AD=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=9A=84subView?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 我在TableViewCell中使用StackView 重用时会出现重复添加view的问题,发现在addArrangedSubView 或 insertArrangedSubview:atIndex: 中 调用了 [self addSubview:view] 或 [self insertSubview:view atIndex:stackIndex] 但并没有在removeArrangedSubview: 中删除添加的view --- FDStackView/FDStackView.m | 1 + 1 file changed, 1 insertion(+) diff --git a/FDStackView/FDStackView.m b/FDStackView/FDStackView.m index c0b8262..712e608 100644 --- a/FDStackView/FDStackView.m +++ b/FDStackView/FDStackView.m @@ -110,6 +110,7 @@ - (void)removeArrangedSubview:(UIView *)view { } [self removeHiddenObserverForView:view]; [self.mutableArrangedSubviews removeObject:view]; + [view removeFromSuperview]; [self.alignmentArrangement removeItem:view]; [self.distributionArrangement removeItem:view]; [self updateLayoutArrangements];