Ankur Patel
Ankur Patel

Reputation: 477

Autolayout dynamic UITableViewcell height

I have created UITableView Cell Dynamic height with use of Autolayout and UITableViewAutomaticDimension.

Problem is that I use UImageView with height of 6 as separator. I set UImageView Top space margin (Vertical Spacing with its above UIButton (Button 2)) but in some situation I do not need to use UIButton(Button 2)

How I can disappear my UIButton(Button 2) and how I can establish UImageView Top space margin (Vertical Spacing with the above UILabel (Country)) because I cannot use UILabel (Desc) in some situation where I do not need UILabel (Desc)

According to API,

(1) UILabel Desc needed and UIButton(Button 2) not needed

(2) UILabel Desc not needed and UIButton(Button 2) needed

(3) UILabel Desc needed and UIButton(Button 2) needed (both needed)

(4) UILabel Desc not needed and UIButton(Button 2) not needed (both not needed)

UIImageView (Separator) come at the end of cell details

UILabel (Name) Compulsory I need

UILabel (Desc) Compulsory I need

UIImageView(Separator) Compulsory I need

Means, I want to make UIImageView(Separator) Top space margin (Vertical Spacing in best way so that I can see in all cell without any extra space between UILabel (Desc)

I have uploaded my project on below link

https://drive.google.com/file/d/0B5mabdphYDhzWG9UMzM2MTV6cms/view?usp=sharing

enter image description here

Upvotes: 13

Views: 505

Answers (2)

cbiggin
cbiggin

Reputation: 2142

May I suggest the obvious solution of configuring several different cell layouts (each with its own own reuse identifier). Seems to me that would save you a lot of time in trying to figure out bizarre auto-layout issues.

Upvotes: 1

Bhadresh Kathiriya
Bhadresh Kathiriya

Reputation: 3244

Please check this screen shot correct or not?

1> Button 2 doesn't need in first cell.

2> Desc doesn't need in second cell.

3> Button 2 and Desc both need in third cell. (First cell in Screen shot 2)

4> Button 2 and Desc both doesn't need.

Download Project this link: https://github.com/BhadreshKathiriya/AutoLayoutSignin

enter image description here enter image description here

Upvotes: 5

Related Questions