简体   繁体   中英

AutoLayout to dynamically size UILabel Height and Width in Map callout?

I have to populate data on 2 UILabels located in .xib. This is used for Google Map SDK iOS for a custom callout (in map annotation). How do I set constraints in interface builder using Auto-layout ?

Here is what I have for now. I need to make height and width dynamic. Thus some callout does not include arrow icon.

在此处输入图片说明

How each label attributes looks like:

在此处输入图片说明

Its almost there, what happening is container view doesn't expand/shrink according to description label.

What are the steps I should follow to build this view from scratch (for the learning purpose as well) ? Plus different ways this can be achieved?

Just change number of lines to "0" for label, auto layout will handle rest of the things. Remove height constraint because the height of the label will be determined by font size and number of lines of text.

在此处输入图片说明 .

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