UIStackView removeArrangedSubview doesn’t actually remove the subview…

Thongchai Kolyutsakul
SwiftBlade
Published in
May 19, 2023

--

Today I tried calling UIStackView’s removeArrangedSubview() to remove the red “Hello world” label. I noticed that instead of the view disappearing, it jumps to top left corner instead!

What on earth is going on…

This was in a small sample project. So I’m 100% sure that there’s no code, of mine at least, that is adding it back.

--

--

Thongchai Kolyutsakul
SwiftBlade

iOS developer since 2009. Working @Viki in Singapore. I write about iOS development, Swift language, and general software engineers tips.