How to get iMessage App view size

How to get iMessage App view size?


I wanna catch the rect size of message app compact mode and expand mode.


Is it possible?

Replies

view.bounds + topLayoutGuide + bottomLayoutGuide is the size of the space between the header and the bottom bar. I believe there is a bug at the moment in seed 2 where that value is wrong in compact mode. I have this code in my app:


controller.view.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
controller.view.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
controller.view.topAnchor.constraint(equalTo: topLayoutGuide.bottomAnchor).isActive = true

if presentationStyle == .compact {
  controller.view.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
} else {
  controller.view.bottomAnchor.constraint(equalTo: bottomLayoutGuide.topAnchor).isActive = true
}

Opened radar #27394756

Is this bug still in beta 3? I am still having issues with the top guide. When I go to expanded then back to compact, the top guide stays the same.

I am still seeing the same issue in beta 3 too.

Clearly, there's something funky going on. It looks like iOS doesn't apply the bottom edge insets when going from expanded to compact. I could reproduce this with the IceCreamBuilder sample app.


I filed radar 27453762, also on Open Radar (without link to avoid moderation)

The beta is now in GM release but I still see this issue. Does anyone have any resolution or alternatives to address the issue?

Check the size after a short timed delay. Especially after the view initially loads. You should find that you get an accurate height after that. I did notice this bug too. Something like this...


Timer.scheduledTimer(timeInterval: 0.5,
                             target: self,
                             selector: #selector(self.resetPickerSize),
                             userInfo: nil,
                             repeats: false)