0

I'm trying to constrain some objects in my tableview cell so that they will be formatted correctly and won't clip on different devices. But, whenever I add a constraint to an object in there, it throws the object off screen to the top left. In the screenshot I attached I showed it with the green bar on the left but the same is true when I do it to the other labels and text fields.

enter image description here

Any ideas as to what I'm doing wrong?

  • I have a near identical table view that gets its data from another source and have them constrained the same way, but that tableview cell is formatted correctly when I build it.

  • I am seeing things online about Tableview cell subclasses. Is there something else I am supposed to be implementing in order to get these to stay? I'm not sure why they are working on one of my tableviews but not the other.

  • I am having the same issue that is being seen here Autolayout is ignored in Custom UITableViewCell but her answer is confusing me and I can't figure out how to reproduce it

This is what it looks like when the app is built:

enter image description here

JoshHolme
  • 303
  • 2
  • 15

1 Answers1

3

Figured it out. For anyone else who may have this problem in the future. You need to click on the content view in the Storyboard and go to the indemnity inspector. Then from there make sure the Class is set to the default of UIView and not the custom class of the TableView Cell.

JoshHolme
  • 303
  • 2
  • 15
  • This is what the post you linked said, but you didn't understand it then :P Was on my way to explain it to you in a comment. –  Sep 03 '17 at 19:26
  • Lol, yes thank you. I couldn't figure out where I was supposed to change it. If you want to post that as an answer I can mark it as the correct answer so you can get the reputation for it – JoshHolme Sep 03 '17 at 19:27
  • Nah it's ok m8, you can just delete this since it is a duplicate anyway, you can add your answer to the old post if you need to clarify anything there :) Cheers –  Sep 03 '17 at 19:28
  • It's stopping me from deleting it so I'm going to have to close both, you might as well get some credit since you had the right answer – JoshHolme Sep 03 '17 at 19:29
  • Oh it might been because I upvoted to give you some rep. Try again. (I ment delete the question entirely btw :P since its a duplicate anyway ) –  Sep 03 '17 at 19:32
  • I tried to delete the question but it wouldn't let me because I think you edited it. And thanks for the rep. Very hard to ask questions without pictures lol – JoshHolme Sep 03 '17 at 19:34