Search code examples
iosswiftxcodeconstraints

Can't add constraints for Table View and Segmeted Conrol on View Controller


I'm new in programming on swift and I try to do one app from some lessons and do step by step. But for some reason when I need to copy Table View on ViewController and set constraints - I can't do it, the same issue if I try add for example Segmented Control, I can't add constraints for him. If I create new VC and add there new Table View + Segmented Control, it's OK, I can add constraints for both. But not in my case, when I already done this Table View with all outlets and actions. Who knows how to fix it? Who had the same problem? Please, Help)))

This is the Storyboard:

enter image description here


Solution

  • If I am correct , you cannot give contraint to a view that you copy from another viewcontroller if the view is main view in the source viewcontroller.

    I found that problem on that case only, but I not do more research about why that happen

    Example: copy tableview from tableviewcontroller to a viewcontroller

    Edit:

    You can copy tableviewcell without broke all the outlet and action connection

    So just add tableview and copy the cell from other VC