Toast-Swift icon indicating copy to clipboard operation
Toast-Swift copied to clipboard

Toast will be covered by keyboardView

Open lixiaoyu opened this issue 4 years ago • 1 comments

lixiaoyu avatar Nov 27 '20 04:11 lixiaoyu

I have a non-verified solution. It works for me on an iPhone with iOS 14.4, and this is enough for my immediate purposes. It works for

let view = UIApplication.shared.windows.last!.subviews.last!

my change for func centerPoint is to add to case .bottom: the folowing:

if UIApplication.shared.isKeyboardPresented {
  return CGPoint(x: superview.bounds.size.width / 2.0, y: (superview.bounds.size.height - (toast.frame.size.height / 2.0)) - bottomPadding -
    UIApplication.shared.windows.last!.subviews.last!.subviews.last!.frame.height)
}

here, isKeyboardPresented is taken from https://stackoverflow.com/a/52417737/192373

alexcohn avatar Apr 06 '21 10:04 alexcohn