LeoNatan / LNPopupController

A framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.
MIT License
3.04k stars 340 forks source link

Can popupController move to tabbar?😓 #178

Closed hstdt closed 1 year ago

hstdt commented 7 years ago

Just like apple music for iPad:

image

LeoNatan commented 7 years ago

Not possible right now, but an interesting challenge for a period of free time.

holeg commented 7 years ago

I vote for this too. Makes lots of sense for running in iPad.

LeoNatan commented 7 years ago

The problem here is that this is not a standard tab bar. Implementing this in a special case custom tab bar is more than possible.

holeg commented 7 years ago

hmm I think its a tabor but Apple can align the items on the left and we not. I experimented a little bit and I was able to shrink the Tabbar in viewWillLayoutSubviews so there is always a space next to it with 320 px. Then I tried to implement bottomDockingViewForPopupBar and defaultFrameForBottomDockingView in my viewController. The problem is that the PopupBar goes then over the whole screen. It starts at y=0 and not with the value I returned in defaultFrameForBottomDockingView. So If the PopupBar would be shown in the frame I return in defaultFrameForBottomDockingView and if the PopupViewController then shows also with the same y coordinate and width, its mostly done.

LeoNatan commented 7 years ago

defaultFrameForBottomDockingView is the frame of the bottom docking view, it does not influence the bounds of the popup bar, just position.

Recently, I introduced insetsForBottomDockingView for iOS 11 safe area support. This could be extended to include the left and right insets as boundaries for the popup bar. At the time I added this property, this was the plan, but I was short on time, and this is a major change.

Another option you have right now is to use a custom bar controller altogether and implement this on your own.

Apple’s example above is not a tab bar. Notice the background translucency is a UIVisualEffectView, rather than the standard tab bar effect view, the tab bar is higher (the height of the popup bar), etc.

LeoNatan commented 7 years ago

More problems to consider: You only want to display the popup bar in this way when you have a regular size class on an iPad. However if the user opens a second app in multitasking, you’d want the popup presentation to fall back to the standard popup bar on top of bottom bar.

I am not saying this is impossible to accomplish, but it is a major undertaking to make all of this in a generic way.

holeg commented 7 years ago

I agree, its not easy but would be nice :-)

LeoNatan commented 7 years ago

That’s why I left the issue open. PRs are welcome.

LeoNatan commented 1 year ago

I don’t think this will ever going to happen. Even Apple has moved away from embedding the MiniPlayer in the tab bar in recent iPadOS versions. A while ago I looked into some private tab bar API that allows adding an accessory view, which could have been the basis for an implementation, but the rest of the logic required so much special casing, it’s something I just can’t bring myself to implement and support.