Simon Moshenko
Simon Moshenko

Reputation: 2166

View in simulator has different frame than in View Hierarchy

I have a strange bug where bottom button hides below the screen. The strange thing is that it is actually tappable and in View Hierarchy it displays as it should be. How could this be? How to debug this problem? Frame and constraints are expected and ok.

Sorry I cannot make a simple example to reproduce because I do not know where the problem lies.

XCode 11, iOS 13

Xcode and simulator

Upvotes: -1

Views: 441

Answers (1)

jonesbasf
jonesbasf

Reputation: 11

I just had a similar experience. Searching around, I found that my view did not have a Safe Area defined (Use Safe Area Layout Guides was not checked in File Inspector). This was an old XIB from prior to Safe Area guides.

After changing this and then adjusting my AutoLayout constraints to reference this rather than the View, things started aligning properly and the View Hierarchy and Simulator matched.

Not sure if this is an absolute answer to your situation, but it solved mine which seems similar.

Upvotes: 0

Related Questions