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

Custom Popup Bar with transparent background #294

Closed
degello opened this issue Oct 3, 2018 · 33 comments
Closed

Custom Popup Bar with transparent background #294

degello opened this issue Oct 3, 2018 · 33 comments
Labels

Comments

@degello
Copy link

degello commented Oct 3, 2018

Hi and thanks for this amazing library,
I've ran into a problem of my own though. I'm wondering if it's possible to make the background color of the minimized view clear instead of just tinting it like in the example. I've tried changing the color in several places but it's only ending up with a completely black background. Look at the image provided to see what i'm trying to achieve. Thanks!

customvc

Something like the minimized youtube player would also be great to achieve, I haven't had any luck by changing the cornerradius (and also using masktobounds of course)
img_0098

@LeoNatan
Copy link
Owner

LeoNatan commented Oct 3, 2018

Hello,

Sounds like you want to subclass LNPopupCustomBarViewController and implement the view of the custom popup yourself.

@degello
Copy link
Author

degello commented Oct 3, 2018

I've already done that, I need to add constraints or some type of insets to present the LNPopupCustomBarViewController in the "middle" like the youtube player or just make the LNPopupCustomBarViewController itself transparent and pin a subview inside it to meet my requirements. Let me know if i'm not clear enough.

@LeoNatan
Copy link
Owner

LeoNatan commented Oct 3, 2018

So I am not sure what the problem is. Add a view and constrain it to have some padding?

@qsdnino
Copy link

qsdnino commented Oct 4, 2018

I've already done that, I need to add constraints or some type of insets to present the LNPopupCustomBarViewController in the "middle" like the youtube player or just make the LNPopupCustomBarViewController itself transparent and pin a subview inside it to meet my requirements. Let me know if i'm not clear enough.

I also have same scenario. Try almost everything and can't make my LNPopupCustomBarViewController subclass transparent. I present presentPopupBar over UITabBarController which is root view controller for application

@LeoNatan
Copy link
Owner

LeoNatan commented Oct 4, 2018

If you set the background color of the LNPopupCustomBarViewController view to transparent, what do you see?

@qsdnino
Copy link

qsdnino commented Oct 4, 2018

If you set the background color of the LNPopupCustomBarViewController view to transparent, what do you see?

Yes, sure. I do that in viewDidLoad and set view background to UIColor.clear. Also I set any other subviews views transparent but without any effect.

@LeoNatan
Copy link
Owner

LeoNatan commented Oct 4, 2018

What does it look like?

@qsdnino
Copy link

qsdnino commented Oct 4, 2018

What does it look like?

It is white

Please follow this link

@LeoNatan
Copy link
Owner

LeoNatan commented Oct 4, 2018

I don't see how that could be. In my maps example, there is an effect view that blurs the content underneath the popup bar. Your view's background is also white. Could you change it to red just o see if the bar remains white?

@iDevelopper
Copy link
Contributor

@degello , @qsdnino , @LeoNatan

Could you have a look at https://github.com/iDevelopper/LNPopupControllerExample ?

I added a custom container controller.

I also added a custom popup bar the Custom Container Demo and replaced the custom popup bar in the Map Scene Demo by one that looks like Youtube bar.

@LeoNatan , I modified LNPopupBar.m too. You should hide the backgroundView view and the shadow view in case of custom popup bar. Or let access to its properties.

There are still some warnings about constraints at runtime in the console but I have not time to investigate.

Hope it helps!

@qsdnino
Copy link

qsdnino commented Oct 4, 2018

@degello , @qsdnino , @LeoNatan

Could you have a look at https://github.com/iDevelopper/LNPopupControllerExample ?

I added a custom container controller.

I also added a custom popup bar the Custom Container Demo and replaced the custom popup bar in the Map Scene Demo by one that looks like Youtube bar.

@LeoNatan , I modified LNPopupBar.m too. You should hide the backgroundView view and the shadow view in case of custom popup bar. Or let access to its properties.

There are still some warnings about constraints at runtime in the console but I have not time to investigate.

Hope it helps!

Can't build project. ContainerController.swift is missing
It shows red in xcode project structure

@iDevelopper
Copy link
Contributor

iDevelopper commented Oct 4, 2018

I don't understand. ContainerController.swift is in the repo and I just downloaded the zip to make a test without any problem! You have to download the whole repo...

@qsdnino
Copy link

qsdnino commented Oct 5, 2018

I don't understand. ContainerController.swift is in the repo and I just downloaded the zip to make a test without any problem! You have to download the whole repo...

Please check this link
There is explainer screenshot how I open XCode project. Can't run example. Am I doing something wrong?

@iDevelopper
Copy link
Contributor

Strange! Is it in the "Demo - Custom Container" folder? If yes, Menu File -> Add Files to "LNPopupControllerExample" and select it.

@degello
Copy link
Author

degello commented Oct 5, 2018

@iDevelopper thanks a lot! I imported your version of LNPopupController and its now possible to have a transparent background. @LeoNatan you should take a look and merge it into the main branch.

@LeoNatan
Copy link
Owner

LeoNatan commented Oct 5, 2018

Pull requests are welcome.

@qsdnino
Copy link

qsdnino commented Oct 6, 2018

@iDevelopper I included ContainerController.swift and build project. It works now and the effect is what all of us need 👍 . However this is not real UITabBarController implementation. I would be great if we could use UITabBarController for presenting custom bar.

@iDevelopper
Copy link
Contributor

It works also with a tab bar controller! In MapScene.storyboard, embed the MapViewController in a tab bar controller and test the Map example.

@iDevelopper
Copy link
Contributor

@LeoNatan , what pull request? You have just two lines to add to hide the background view and the shadow view:

- (void)_updateViewsAfterCustomBarViewControllerUpdate
{
	BOOL hide = _customBarViewController != nil;
    // For Custom Popup Bar View
    _backgroundView.hidden = hide;
    _shadowView.hidden = hide;
    //
	_toolbar.hidden = hide;
	_titlesView.hidden = hide;
}

But may be you prefer to use some boolean properties to do that regarding the older projects?

@LeoNatan
Copy link
Owner

LeoNatan commented Oct 6, 2018

I’ll take a look.

@LeoNatan
Copy link
Owner

LeoNatan commented Oct 8, 2018

Using

popupBar.isTranslucent = false
popupBar.backgroundColor = .clear

I can already achieve full transparency of the popup bar. There is a small artifact of the hairline, which I am thinking of limiting to translucent bars only.

This is a better solution as it allows custom popup bars to still have the system background, if desired.

@iDevelopper
Copy link
Contributor

Yes, there remains the problem of the shadow view that we do not necessarily want to keep.

@qsdnino
Copy link

qsdnino commented Oct 8, 2018

Using

popupBar.isTranslucent = false
popupBar.backgroundColor = .clear

I can already achieve full transparency of the popup bar. There is a small artifact of the hairline, which I am thinking of limiting to translucent bars only.

This is a better solution as it allows custom popup bars to still have the system background, if desired.

@LeoNatan, @iDevelopper Is possible to hide hairline? I acheive to have transparen custom popup bar, but there is hairline at the top.

@iDevelopper
Copy link
Contributor

@qsdnino ,

@LeoNatan said:

There is a small artifact of the hairline, which I am thinking of limiting to translucent bars only.

Waiting for a commit...

@LeoNatan
Copy link
Owner

LeoNatan commented Oct 8, 2018

Already committed.

@LeoNatan LeoNatan closed this as completed Oct 8, 2018
@Kedar-27
Copy link

Kedar-27 commented Aug 20, 2019

@LeoNatan @iDevelopper....how can we achieve full transparent background of popup content view of custombar controller....because, currently, it is showing blur view on background...is there any solution ..in short wanted to achieve full transparency on custombar controller

@Kedar-27
Copy link

@LeoNatan @iDevelopper....how can we achieve full transparent background of popup content view of custombar controller....because, currently, it is showing blur view on background...is there any solution ..in short wanted to achieve full transparency on custombar controller

can somebody please help

@LeoNatan
Copy link
Owner

@Kedar-27 Please don't spam threads. This is not your personal support forum and nobody owes you basic usage help.

As I said, read the documentation.

popupBar.isTranslucent = false
popupBar.backgroundColor = .clear

@Kedar-27
Copy link

Kedar-27 commented Aug 21, 2019

popupBar.isTranslucent = false
popupBar.backgroundColor = .clear

I read your documentation.....but my problem is with popupcontentview not with popup bar....want transparency on custombarcontroller not popupbar

@LeoNatan
Copy link
Owner

I don't think it's possible. If there is transparency in the content controller's view (alpha < 1.0), a blur effect is applied.

@Kedar-27
Copy link

I don't think it's possible. If there is transparency in the content controller's view (alpha < 1.0), a blur effect is applied.

can we remove that blur effect

@LeoNatan
Copy link
Owner

Not at the moment.

@LeoNatan
Copy link
Owner

Open a new feature request issue. @Kedar-27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants