简体   繁体   中英

how to programmatically reorder items within a UIStackView in IOS?

How can one programmatically reorder items within a UIStackView in IOS?

(ie I can not see a function at https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIStackView_Class_Reference/#//apple_ref/doc/uid/TP40015256-CH1-SW30 to cover this)???

When adding a view to a parent view, it is automatically removed from it's old parent view.

This is the same with arrangedView , so you only need to use insertArrangedSubview(_:atIndex:) and addArrangedSubview() .

Using removeArrangedSubview() is not needed.

surely you can use a combination of

removeArrangedSubview(_:)
insertArrangedSubview(_:atIndex:)

to reorder your views?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM