Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top Safe Layout not support (Solution in Details Please update it) #298

Open
vipinsaini0 opened this issue Oct 7, 2021 · 1 comment
Open

Comments

@vipinsaini0
Copy link

I found this issue and also solved it here is the solution,

In DropDown.swift file

Add this code in this function.

func computeLayoutForTopDisplay(window: UIWindow) -> ComputeLayoutTuple

if #available(iOS 11.0, *) {
            windowYAix = window.safeAreaInsets.top
        } else {
            // Fallback on earlier versions
        }
		let windowY = windowYAix + DPDConstant.UI.HeightPadding

And After that look like this

fileprivate func computeLayoutForTopDisplay(window: UIWindow) -> ComputeLayoutTuple {
   	var offscreenHeight: CGFloat = 0

   	let anchorViewX = anchorView?.plainView.windowFrame?.minX ?? 0
   	let anchorViewMaxY = anchorView?.plainView.windowFrame?.maxY ?? 0

   	let x = anchorViewX + topOffset.x
   	var y = (anchorViewMaxY + topOffset.y) - tableHeight
       var windowYAix = window.bounds.minY
       
       if #available(iOS 11.0, *) {
           windowYAix = window.safeAreaInsets.top
       } else {
           // Fallback on earlier versions
       }
   	let windowY = windowYAix + DPDConstant.UI.HeightPadding

   	if y < windowY {
   		offscreenHeight = abs(y - windowY)
   		y = windowY
   	}
   	
   	let width = self.width ?? (anchorView?.plainView.bounds.width ?? fittingWidth()) - topOffset.x
   	
   	return (x, y, width, offscreenHeight)
   }
@vipinsaini0
Copy link
Author

Please update this in your project, so help others.

@vipinsaini0 vipinsaini0 changed the title Top Safe Layout not support Top Safe Layout not support (Solution in Details Please update it) Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant