0

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

Ankur Lahiry
  • 2,253
  • 1
  • 15
  • 25
Qasem M. Zreaq
  • 139
  • 1
  • 1
  • 10
  • 1
    Does this answer your question? [iOS: Modal ViewController with transparent background](https://stackoverflow.com/questions/12741224/ios-modal-viewcontroller-with-transparent-background) – Ankur Lahiry Jun 01 '22 at 03:22

2 Answers2

1

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
}
Harry J
  • 1,842
  • 3
  • 12
  • 28
-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)
Ankur Lahiry
  • 2,253
  • 1
  • 15
  • 25