Widget “flip” behavior in Core Animation/Cocoa

前端 未结 7 1958
执笔经年
执笔经年 2020-11-30 02:31

I\'m trying to make a Card class that duplicates the behavior of Dashboard widgets in that you can put controls or images or whatever on two sides of the card and flip betwe

7条回答
  •  旧时难觅i
    2020-11-30 03:11

    If you are able to do this with images, perhaps you can keep all of your controls in an NSView object (as usual), and then render the NSView into a bitmap image using cacheDisplayInRect:toBitmapImageRep: just prior to executing the flip effect. The steps would be:

    1. Render the NSView to a bitmap
    2. Display that bitmap in a layer suitable for the flip effect
    3. Hide the NSView and expose the image layer
    4. Perform the flip effect

提交回复
热议问题