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
UIButton action in bar controller is ignored in 2.10.0 #397
Comments
Hmm Thanks, will have a look soon! |
Sorry, I can't reproduce. In the demo app, I added the following code to the custom bar controller's
The button can be tapped. |
When visually debugging the view hierarchy i see an additional empty UIView in front of the custom bar controller with 2.10.x. Could this be an issue? The working version that i used before i updated to 2.10.x was v2.8.5. |
Could you post a view hierarchy dump from Xcode 12? File -> Export View Hierarchy, and post the pointer of the offending view. But I am not seeing this behavior in the demo app, so I'm not sure if it's something in the framework. |
Please provide the hierarchy with the latest release of |
Sorry for my late answer, i was busy updating some apps for iOS 14. The address of the view in the attached hierarchy is 0x7fe1adff7c00. With 2.8.5 this view is not there. |
Thank you! |
This is the same situation recorded with 2.10.5, the play button is not getting the user's touch. Something is intercepting it since 2.10.x (i did not try 2.9.x). The button works when i use to 2.8.5. But there's also good news: The layout issues i experienced with 2.10.1 are fixed :-) |
Please notice that that view has |
I don't see anything in the framework causing this. The demo project works as expected. Try debugging the touch handling to see who finally takes it. |
When i break in LNPopupOpenTapGesutreRecognizer.m at the line
Then the touch.view does not hold my UIButton with 2.10.5: Even if i change that method and return NO the button is not activated. Do i have to configure the PopUpController differently in 2.10.x than in 2.8.x?
But the touch.view does hold my UIButton with 2.8.5: I added
to my subclass of LNPopupCustomBarViewController and when i try to touch the UIButton
The button is still not activated. I guess the handling of custom LNPopupCustomBarViewController subclasses is broken in 2.10.x. The demo app does not use a custom LNPopupCustomBarViewController, right? |
It does use it. There is a “maps” demo scene which has a custom bar controller. This is where I added a button to test. My money is on something broken on your end. Nothing changed with regards to bar controllers. |
Hi @MacMark , |
I do not understand yet what might be wrong in my controller because it works with 2.8.x and just by replacing 2.8.x with 2.10.x it gets into this issue. I will compare the sample custom bar controller with my controller. |
@MacMark , |
Hi @iDevelopper, I will also try it with a pure UIButton but for me it looks like the _LNPopupBarContentView does not hold the view of my controller at all in #397 (comment) when i use 2.10.x. |
@MacMark , |
The custom bar controller is added directly to the popup up bar content view:
@MacMark Let's try an experiment. Could you create a new subclass of the custom bar controller, with no logic in it, just a button? Let's see if that button works. |
As long as the custom controller has also a normal UIButton (it might even be hidden) the PlayPauseButton (subclass of LottieButton which is in turn a subclass of UIButton) works as normal (receives the touch because it is in touch.view). @LeoNatan To answer your question: This means a normal button works in my controller. |
WTF is going on. I can't explain it. |
@MacMark , |
I paused the app via Xcode, selected the PlayPauseButton and then printed its description Printing description of $43: (lldb) po 0x7fc4f6c152c0 (lldb) po [(id)(0x7fc4f6c152c0) class] (lldb) po [(id)(0x7fc4f6c152c0) superclass] (lldb) po [[(id)(0x7fc4f6c152c0) superclass] superclass] @LeoNatan This should be the view hierarchy according to Apple's docs:
@iDevelopper I will try and provide a small sample reproducing it. |
This is a minimal project showing my problem. The popup and the play button work fine (it logs a debug output). As soon as the blue button is hit, it removes itself from superview and the play button stops working because the setPreferredContentSize in LNPopupCustomBarViewController seems to go to zero height. This was not the case with 2.8.5. Proof: Replace 2.10.5 in the Podfile with 2.8.5 and run "pod install". Run the project again. And it will work fine. |
Do you correctly set the |
Check what size is returned from your calculation. |
The problem seems to be there (LNPopupBar.m line 1161): Replace: _customBarViewController.view.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_customBarViewController.view];
[NSLayoutConstraint activateConstraints:@[
[self.contentView.leadingAnchor constraintEqualToAnchor:_customBarViewController.view.leadingAnchor],
[self.contentView.trailingAnchor constraintEqualToAnchor:_customBarViewController.view.trailingAnchor],
[self.contentView.centerXAnchor constraintEqualToAnchor:_customBarViewController.view.centerXAnchor],
]]; with: _customBarViewController.view.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_customBarViewController.view];
[NSLayoutConstraint activateConstraints:@[
[self.contentView.leadingAnchor constraintEqualToAnchor:_customBarViewController.view.leadingAnchor],
[self.contentView.trailingAnchor constraintEqualToAnchor:_customBarViewController.view.trailingAnchor],
//[self.contentView.centerXAnchor constraintEqualToAnchor:_customBarViewController.view.centerXAnchor],
[self.contentView.topAnchor constraintEqualToAnchor:_customBarViewController.view.topAnchor],
[self.contentView.bottomAnchor constraintEqualToAnchor:_customBarViewController.view.bottomAnchor]
]]; |
@iDevelopper I replaced the code like you suggested and it works with the demo project and also with my original app 👍 ✌️🎉 (And thus my previous comment was wrong). |
@LeoNatan , However, with a tab bar controller, it not works. The vertical constraints of the custom bar view controller' view are ambiguous, and its height is equal to zero. This is why the button is misplaced (I have set some constraints to it) and is not triggered. Here is a very small sample project that demonstrates the issue. |
It's like this for a reason. The fix should be different. I will take a look soon. |
Ah and what is the reason, please? |
There were multiple popup bar layout issues without this. I need to understand why the layout is failing in this case, but not in the example project. Could still be a user error. |
I think I'm starting to see where the issue is. In my demo scene, the controller has constraints that express its size, where as in the example, this isn't the case. |
I'm not sure adding a constraint is the right thing to do. It might just be the case that if you are using auto layout, you should have all the constraints yourself. If I add a height constraint in the framework, it breaks genuine cases where one might want to change the height of the bar using a constraint, and then rely on |
OK, I've made an improvement. Please test. The system now takes into account |
When using 2.10.6 with my app the play button works again ✌️😍 But i'm having again some layout problems like with earlier version of 2.10.x (before 2.10.5): The bottom of the view controller behind the popup bar is covered by the popup bar when the navigation bar on top is hidden. In this screenshot 1 and a half row of the table are hidden by the popup bar which was not the case with 2.10.5 I would like to have the correct layout of 2.10.5 and the working play button of 2.10.6 😎 With the suggested change from @iDevelopper i run into a similar layout problem. |
Just to make sure, the issue is that the bottom inset is not correctly set? Please open an issue. |
Yes, it is the bottom inset. Thx, i will open a new issue. |
Description
UIButton action not triggered anymore in CustomBarViewController. It worked in 2.8.5 but not in 2.10.0 anymore.
Steps to Reproduce
Use an UIButton in the UIViewController that you use for setCustomBarViewController. Touch the button. The action of that button is not triggered. Instead the full screen controller is presented.
Device, OS and Xcode Versions
iPhone X, iOS 14, Xcode 12 beta 4
The text was updated successfully, but these errors were encountered: