Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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=sharingenter image description here

like image 753
Ankur Patel Avatar asked Sep 09 '16 07:09

Ankur Patel


2 Answers

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

like image 146
Bhadresh Kathiriya Avatar answered Oct 21 '22 13:10

Bhadresh Kathiriya


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.

like image 1
cbiggin Avatar answered Oct 21 '22 13:10

cbiggin