ios - XCode adds duplicate constraints? -


well, in code added 4 constraints. when run app, in ui debugger, shows additional 6 constraints? should clear these 4 added, dont know doing wrong?

let leftconstr = nslayoutconstraint(item: image, attribute: .leading, relatedby: .equal, toitem: cell.contentview, attribute: .leading, multiplier: 1.0, constant: 0.0) let bottomconstr = nslayoutconstraint(item: image, attribute: .bottom, relatedby: .equal, toitem: cell.contentview , attribute: .bottom, multiplier: 1.0, constant: 0.0) let highthconstr = nslayoutconstraint(item: image, attribute: .height, relatedby: .equal, toitem: nil, attribute: .notanattribute, multiplier: 1, constant: 15) let widthconstr = nslayoutconstraint(item: image, attribute: .width, relatedby: .equal, toitem: nil, attribute: .notanattribute, multiplier: 1, constant: 50) cell.contentview.addconstraints([highthconstr, widthconstr, bottomconstr, leftconstr]) 

here screenshot of ui debugger

https://i.stack.imgur.com/3fzc2.png

maybe can try add line of code before :

image.translatesautoresizingmaskintoconstraints = false 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -