Tom
Tom

Reputation: 3627

UITableViewCell with custom control

I am trying to create derived UITableViewCell.

The right side (cyan color, 200 in width but will be resized in future at runtime) contains my rating control.

On the left is a UIView (blue color) filling the remaining space. It contains a text label which takes all the space here. (In the future I hope to resize the the table cell in height, so it can contain whatever text is in the label.)

However, it utterly ignores my instructions. I have set rating control to have zero right margin. The UIView has zero left margin. The UIView right side = rating control left side.

And with the the fixed rating control width, it should work? But on the contrary. both things are pushed all to the left. (Like uiview with text label is maybe 20% width and rating control 20% in width - rest empty space)

enter image description here

Upvotes: 0

Views: 58

Answers (1)

BangOperator
BangOperator

Reputation: 4437

I am not able to read all your constraints but your "Score View" (lets call it A) and "Rating View" (lets call it B) must have SEVEN (I can only see 6 of them) constraints that should be pinned to their superview i.e. "Content View".

The constatins should be

A.leading = superview.leading

A.top = superview.top

A.bottom = superview.bottom

A.trailing = B.leading

B.top = superview.top

B.bottom = superview.bottom

B.trailing = superview.trailing

Upvotes: 1

Related Questions