Hello All!
Everything I've read (Xcode online docs, iOS programming manuals, etc.) indicate that the best way to move a subview within its parent is to change its .center (.x or .y) property.
I have been trying to figure this out for a bit now and the only way I can make a subview move is to change the .frame.orgin of its parent, which moves all the subviews - not what I want.
Why can't I make changing .center work in the following code snipet (self is the parent View Controller)?
// Load POI menus
let poiMenus = Bundle.main.loadNibNamed("POIMenuViews", owner: nil)!
let primaryPOIMenu = poiMenus[0] as! UIStackView
self.view.subviews[0].addSubview(primaryPOIMenu) // works down to here
primaryPOIMenu.center.x += 88 // This NO WORKY!!! Why???
NOTE: The primaryPOIMenu.center.x IS changing (confirmed) but the subview is not moving. I tried using .center similarly in another place and that subview didn't move either.
I'm very confused - this should be simple.
Thanks in advance.
4
0
1.2k