Thanks for the awesome library! 👍
What are you trying to achieve with this library exactly? Please describe.
I just have one question. The position of toolbar too close to the bottom:
Has it an incorrect safeAreaInsets.bottom?
Need a reproducible example project? TestSafeArea.zip
@zhangao0086 same issue here on iOS13, also when u tap Cancel app crashes.. any updates on this ?
ping...
Hi there!
The reason is in a custom VC transitioning of CropViewController. To fix this issue we have to make some research about differences in iOS13 related to transitioning or.... just disable it :)
file: CropViewController.swift, string: 561.
fileprivate func setUpCropController() {
addChild(toCropViewController)
transitioningDelegate = (toCropViewController as! UIViewControllerTransitioningDelegate)
toCropViewController.delegate = self
toCropViewController.didMove(toParent: self)
}
To use use a default transition we can comment/remove this line:
transitioningDelegate = (toCropViewController as! UIViewControllerTransitioningDelegate)
I don't think this issue is a matter of the custom transition alone. I present the controller by pushing it from a UIImagePickerController in a popover. The popover in iOS 13 includes the arrow in the view, so this controller now thinks it is larger than it is and takes up the extra space for the arrow. So if the arrow is on the right side, this controller's content leaks off the screen on the right side, etc. Something needs to be modified with safe area, but I am not sure what would fix this - especially as it is all done programmatically and there are several views involved.
I believe that the safeAreaLayoutGuide needs to be used somehow, somewhere to fix this. I just went through the code and it doesn't look like it is included anywhere. Wish I could be more help. Here are a couple more places where people are having this issue, which also include some ways it might possibly be approached:
https://stackoverflow.com/questions/57866771/ios-problem-of-display-the-popover-border-in-the-ios13
Also, if this has been fixed in the current code, I might not be seeing it as I am using Carthage, although I just checked and there are no updates
Any update on this? @TimOliver
Hi @zhangao0086. Thanks so much for the comprehensive sample app!
I'm busy putting out iOS 13 fires in some of my other projects now, so I haven't had a chance to look at this yet. Sorry!
I'll look into it when I can. In the meantime, if anyone finds the fix and can submit a PR, that would be very appreciated!
I originally made CropViewController
a separate view controller since it wasn't possible to convert all of TOCropViewController
's Objective-C interface to Swift at the time. But I think the interoperability has improved to the point where we can potentially ditch the wrapper now. Hopefully that'll prevent issues like this in future.
@TimOliver Thanks for your reply! I totally understand you😃
Hi @zhangao0086! Sorry for the delay!
I finally got some free time to examine what was going on. It was strange because even on the parent container level, the safeAreaInsets
were 0 except for the notch.
I think I fixed it though. This was another side effect of the new iOS 13 modal display. It turns out if you don't set modalPresentationStyle
to .fullScreen
, the view controller doesn't seem to obey the insets.
I haven't shipped a new pod release yet (My CI server fell over when I updated it to Catalina. 😅), but I added the .fullScreen
flag to the master branch. Can you please try pulling from master and seeing if it works for you now?
The syntax to pull from master via CocoaPods is:
pod 'CropViewController', :git => 'https://github.com/TimOliver/TOCropViewController.git'
Thanks!
@TimOliver Thanks a lot for your great job!
Wonderful! It's working exactly as I expected! 👍
I also had to set cropViewController.modalPresentationStyle = .fullScreen
in my code (not just update to master branch). Adding a note here as that wasn't clear to me
This fix seems to only work for Swift code. Does anyone know why it's not working in objective C?
Most helpful comment
Hi @zhangao0086! Sorry for the delay!
I finally got some free time to examine what was going on. It was strange because even on the parent container level, the
safeAreaInsets
were 0 except for the notch.I think I fixed it though. This was another side effect of the new iOS 13 modal display. It turns out if you don't set
modalPresentationStyle
to.fullScreen
, the view controller doesn't seem to obey the insets.I haven't shipped a new pod release yet (My CI server fell over when I updated it to Catalina. 😅), but I added the
.fullScreen
flag to the master branch. Can you please try pulling from master and seeing if it works for you now?The syntax to pull from master via CocoaPods is:
Thanks!