skip to Main Content

how to remove the default gray colour when change detent in modal presentation from medium to large ? enter image description here

I need to remove this gray colour attached in above image while drag page sheet or move it I need to make it Transparent colour while moving modal to be like this when move from medium detent to large one

enter image description here

2

Answers


  1. You should have to set the view background color to be clear before presenting the modal

    self.view.backgroundColor = .clear
    self.modalPresentationStyle = .currentContext
    self.present(nextVC, animated: true, completion: nil)
    
    Login or Signup to reply.
  2. If you are using UISheetPresentationController to present. You can look at largestUndimmedDetentIdentifier.

    If you set that variable to .large your medium detent will have no dimmed background.

    if let sheet = vc.sheetPresentationController {
        sheet.detents = [.medium(), .large()]
        sheet.prefersGrabberVisible = true
        sheet.selectedDetentIdentifier = .medium
        sheet.prefersScrollingExpandsWhenScrolledToEdge = false
        sheet.prefersEdgeAttachedInCompactHeight = true
        sheet.largestUndimmedDetentIdentifier = .large
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search