Any solution for Cocoa push/pop of view controllers?
Let me get this out of the way: I'm use开发者_如何转开发d to to UIKit
, where you can push/pop view controllers to your hearts content. That just doesn't work on the Mac.
With TwUI
, this works extremely well on the Mac. For example, look at @joshaber
's push/pop example using TwUI. If TwUI
was completely stable and capable of embedding AppKit
controls inside a TUIView
, I would ditch AppKit completely. However, not everything can be done in TwUI
, and I need to retain AppKit for some things.
Thus brings my question. How can something like this be accomplished using AppKit? Is there a library that has made this easy? Or do we need to make it ourselves? Just using replaceSubview:withSubview:
isn't enough, and isn't really pushing/popping views.
You're asking about how to push/pop NSViews? I have another example on GitHub at https://github.com/joshaber/ReederDemo that does that. You can take the guts of PPNavigationController from TwUIPushPopTest and replace it with the stuff to do the animation in ReederDemo. It'd still be far from complete, but it'd at least get you pushing and popping view controllers with a kinda-right animation.
Ah, I think I found what I was looking for.
Behold PXNavigationBar
:
Combining this and Josh's push/pop example I've come up with a good system. I'll leave Josh's example selected because that fixes the root problem.
精彩评论