dynamic - iOS: Getting height of views with programatically added constraints as only indicator -


Hello there, Partner IOS Programmer, while creating an app, I have participated in a problem, I could not find the answer. Let's keep it:

I am creating a UIViewController with UIScrollView because it is only a child in this view I have a UIView, and inside it is a list of UIVables in which there are UILabels inside them. As you all know, you have to specify the content size for the UCcrollView. The problem is that the list needs to be dynamic with its contents, and so I have no way of knowing the visual height already. I am connecting all the scenes with the constraints where the height is set to "> = 0" when I try to set the height of the UIScrollView later, then I get the height of the UIView in the list Is required, or the original and height of the last scene is obtained in the list. Of course it is time to see when the view is displayed to the user.

I have tried view.systemLayoutSizeFittingSize (UILayoutFittingCompressedSize), which is returned 0; See SystemLayoutSizeFittingSize (UILayoutFittingExpandedSize), which returned 10000; See more.Origin + View.frame.height, whatever gives. I feel like obstacles have not yet taken effect.

I have tried both hurdles and UISCOLVU. From Viewedload () I tried to set the barriers in visual deedload and set WillAppear to see contentSize; Setting the restrictions in this one outcome result in the same result WillAppear and set the content View in viewDidoadload is the cause of only one crash.

Bottom line: I should set up UIScrollView.contentSize when I want to get the view. Are there similar ways to return the right result, while the user can be ready by looking at the time?

BTW, I'm making this app in SWIFT, so the answer is preferred in this language, but I am able to translate from Objective-to-SWIFT;

Thank you! :)

You say:

As you all know You have to specify any contentSize for UIScrollView .

No, as it says, the barriers between the scroll view and its subview "means the view of the scroll view as the content size ) It's a boon because now you do not have to mess with the contentSize if Auto-layout is set, set the barriers to the subviews of the scroll view and the size of the content takes care of themselves It takes the inner shape of the labels (and the sunsh Figure out that the label's number is OFFLINE ).

The only move is that it can sometimes not understand the correct width of the label (because the content size of the previous barrier scroll view It sometimes makes scrolling a horizontally scrollable one). You can either manually preferredMaxLayoutWidth settings or label and scroll view supervision A barrier between the width

Individually, as long as I understand the inclination to add between the scroll view and the label UIView , I lose them As long as you do not want them for any other reason, IMHO, this simply makes obstacles unnecessarily complicated because it is quite hairy because it is. Obviously, if these containers bear other utility for you, then go ahead and keep them (and they will work fine), but if you are just doing this for obstacles, then you may consider destroying them Are there.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -