Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
我在TableViewCell中使用StackView 重用时会出现重复添加view的问题,发现在addArrangedSubView 或 insertArrangedSubview:atIndex: 中 调用了 [self addSubview:view] 或 [self insertSubview:view atIndex:stackIndex] 但并没有在removeArrangedSubview: 中删除添加的view
- Loading branch information
aefb40b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这边有问题,请参考UIStackView系统removeArrangedSubview实现:
系统原生的UIStackView的removeArrangedSubview方法的注释是这样的:
Removes the provided view from the stack’s array of arranged subviews.
This method removes the provided view from the stack’s arrangedSubviews array. The view’s position and size will no longer be managed by the stack view. However, this method does not remove the provided view from the stack’s subviews array; therefore, the view is still displayed as part of the view hierarchy.
To prevent the view from appearing on screen after calling the stack’s removeArrangedSubview: method, explicitly remove the view from the subviews array by calling the view’s removeFromSuperview method, or set the view’s hidden property to YES.
有人提出issue: #35