1

I want to increase UIView size according to array count. Currently, I am doing this -:

var socialMediaURLSArray = [URL]()

and in View did load i am doing this -:

 viewHeightConstraints.constant = (60 * 1) + 170

In place of 1, I want to define socialMediaURLSArray count.

1 Answer 1

1

In place of 1, I want to define socialMediaURLSArray count.

so

viewHeightConstraints.constant = (60 * socialMediaURLSArray.count) + 170

You may need to to the above code inside the didSet of the socialMediaURLSArray to make it auto update.

You may need to call view.layoutIfNeeded() to update the constraint. Also you can perform it inside an animation block

Sign up to request clarification or add additional context in comments.

2 Comments

it always show socialMediaURLSArray.count = 0
Are you appending urls to the socialMediaURLSArray ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.