开发者

Sliding from One View to Another

How would I change from one view to another w开发者_如何转开发ith a slide transition?

Thanks.


Place them side by side, and use NSViewAnimation to perform the animation.

This may turn out tricky if the views' size can change. Doubly so if the two views are not the same size as each other.


Marcus Zarra gives a good example of how to use Core Animation to achieve this effect in his post on how to implement a wizard. It's very simple to do using subviews and a CATransition.


Implement all the actual drawing using CALayers. (Having not used Core Animation myself, I can't get more specific.) Put them in a single view, hosting that layer hierarchy, and use Core Animation to perform the slide transition.

This may not work so well if the views are not display-only—that is, if they host controls that the user can interact with. Layers are more or less display-only, since you can't put a view in a layer, and only views, not layers, are responders.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜