Closed JosephZZ closed 8 years ago
Can you prepare simple demo for that? You can have some issues in your application like keepin strong reference or something else..
Before clicking the background:
After clicking the background:
The code is just simple code:
let selectAlbumController = self.formSheetAlbumSelectionController() as! SelectAlbumTableFormSheetViewController let formSheetController = MZFormSheetPresentationViewController(contentViewController: selectAlbumController) //some more code for setting the transition effect // self.presentViewController(formSheetController, animated: true, completion: nil)
To your strong reference point, my SelectAlbumTableFormSheetViewController has a delegate variable of my own protocol, and it has IBAction and weak IBOutlet reference to it. But even if after i made the protocol weak, this problem is still there.
I guess it might have to do with table view delegate. This problem would only happen if I scroll the table view up and down pretty fast. And this view would not exist no matter if I click the background or select a cell (which would trigger dismissingview function).
I need a sample because uou could keep strong reference to some of viewController thats why it is not dismissing
yeah sure. just to clarify, when you say "sample" you mean a code project that can replicate this bug?
Yes, Short example rhat can replicate this
I have been encountering the same issue for a few months now. It's clearly not easy to reproduce, but I have been able to gather some info while testing my app:
dismissViewControllerAnimated:YES completion:nil
will.willDismissContentViewControllerHandler
is called, didDismissContentViewControllerHandler
is not. (viewDidDisappear:
in MZFormSheetPresentationViewController.m
is not called either).Here is my code:
- (void)openProfile
{
UIViewController *modalViewController = [[UIViewController alloc] init];
UINavigationController *modalNavigationController = [[UINavigationController alloc]
initWithRootViewController:modalViewController];
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector(closeModal)];
modalViewController.navigationItem.leftBarButtonItem = closeButton;
MZFormSheetPresentationViewController *formSheetController =
[[MZFormSheetPresentationViewController alloc] initWithContentViewController:modalNavigationController];
formSheetController.interactivePanGestureDissmisalDirection = MZFormSheetPanGestureDismissDirectionAll;
formSheetController.contentViewControllerTransitionStyle = MZFormSheetPresentationTransitionStyleSlideFromBottom;
formSheetController.presentationController.contentViewSize = ModalSize;
[self.navigationController presentViewController:formSheetController animated:YES completion:nil];
}
- (void)closeModal
{
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
In my app, modalViewController
class is a custom subclass of UIViewController
. I won't put all my code here because I think it's irrelevant (and it would take pages and), but also because it's a closed-source project.
Do you think it's necessary to you?
Attempts to fix it which didn't change anything:
dismissViewControllerAnimated:YES completion:nil
to the parent navigation controller, or to the modal view controller, or to the modal navigation controller, or to the MZFormSheetPresentationViewController
object.MZFormSheetPresentationViewController.h
, calling super
on first line of viewWillDisappear
and viewDidDisappear
overrides.If you prepare some short sample project where this exist, this will be for me very super fast to try to fix that, i am lazy man, without this it could take some time to make it by myself :dancer: So please craete sample project, and i will help you guyse
Will do.
Here you go: https://cloudup.com/c4clYcQzCcc I tried to code the smallest project possible to reproduce issue.
In a simple project like that, the issue appears way less often. And since the issue happens much more rarely on simulator than on device, I have been able to reproduce it on device only (iPhone 6 in my case).
I end up with the following state (you can see the background is not dimmed) :
(sorry for the poneyland colors)
In that state, the Done
button does nothing, and the only way to dismiss the modal is by using a pan gesture.
The issue is because mixing interactive and normal animator, i need more time to fix the issue. Could you tell me how to reproduce your issue (what to do) because i probably i could found another issue.
To reproduce the issue you have to open the modal, scroll a few times in it, then hit the Done
button.
It may happen once every 5 times, ad well as once every 60 times. As I said, it's hard to reproduce...
Okay so it is the same issue, you need to in the same time click done button and try to pan to dismiss and will be reproducible, i will take care of it in some time
Ha, yeah you're right. If I press and hold the Done
button and just after try to swipe down, release, and then hit the Done
button, it happens systematically.
After present a view controller, and generally after I click on some parts in this presented view, and then when I click on the background, this view doesn't disappear but only causes the background from blur to clear. I saw someone else also have this problem from the older version https://github.com/m1entus/MZFormSheetController/issues/191.