Bottom anchor constraint not appear the same on iPad as iphone [closed]

My swift code is trying to constraint a imageview to appear on the top of the axis. So the bottom of the imageview is the x axis. The code is working on a iPhone with the desired result however on a iPad the code does not work. You can see what I am talking about in the image below.

oYw2l

    [box,theBox].forEach({
$0.translatesAutoresizingMaskIntoConstraints = false
view.addSubview($0)
 }


  )
    NSLayoutConstraint.activate([

box.heightAnchor.constraint(equalTo: view.heightAnchor, multiplier: 0.1),
box.widthAnchor.constraint(equalTo: view.widthAnchor,multiplier: 0.1),
box.centerXAnchor.constraint(equalTo: view.centerXAnchor),
box.bottomAnchor.constraint(equalTo: view.centerYAnchor),


theBox.heightAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6),
theBox.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6),
theBox.centerXAnchor.constraint(equalTo: view.centerXAnchor),
theBox.centerYAnchor.constraint(equalTo: view.centerYAnchor),

    ])

@timswift Do you still have issues with this?

This topic was automatically closed after 166 days. New replies are no longer allowed.