I am trying to animate each view of NSTabView with a slide in when the view is selected. I have this working in a fashion, but it only animates the first time i select a new tab view. After that i do not see an animation when switching tab views, although i can see the the function is fired every time.?
override func tabView(tabView: NSTabView, didSelectTabViewItem tabViewItem: NSTabViewItem) {
tabViewItem.view!.setFrameOrigin(NSPoint(x: tabViewItem.view!.frame.origin.x + 300, y: tabViewItem.view!.frame.origin.y))
tabViewItem.view!.animator().setFrameOrigin(NSPoint(x: tabViewItem.view!.frame.origin.x - 300, y: tabViewItem.view!.frame.origin.y))
// i can see this fires every time i switch tab views but the animation only works the fist time
}
I have changed it a little to solve first time problem. Just define an integer to store previous tab index in your delegate.