Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

determining the intrinsic size of a UIStackView before display on the screen

I would like to determine the instrinstic size of a stack view before displaying it on the screen. The idea is to use it as part of a pull up menu from the bottom of the screen but when I query the object before it appears it has size (-1,-1). Is there anything I should do first before my call to instrinsic content size?

like image 805
drw Avatar asked Apr 03 '16 20:04

drw


1 Answers

UIStackView has no intrinsic content size. You're getting -1 because that is the value of UIView.noIntrinsicMetric.

Instead, ask for its fitting size:

let size = stackView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize)
like image 62
rob mayoff Avatar answered Oct 22 '22 08:10

rob mayoff