How to get height of topLayoutGuide?

后端 未结 3 555
太阳男子
太阳男子 2021-02-01 15:23
 moviePlayer = MPMoviePlayerController(contentURL: url)
 moviePlayer.view.frame = CGRect(x: 0, y:{layoutguide.height}, width:
 self.view.frame.width, height: 300)
 self.         


        
3条回答
  •  温柔的废话
    2021-02-01 16:12

    If someone is looking for how to calculate the height of insets of SafeLayoutGuide available for iOS 11 because Top and Bottom Layout Guide are deprecated now, you can find it in:

    view.safeAreaInsets
    

    Notice that Top and Bottom Layout Guide were a part of ViewController, and now SafeLayoutGuide is a part of the main view of the ViewController.

提交回复
热议问题