Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between a CoreAnimation Layer Backed View and a Layer Hosting View?

What is the difference between a Layer Backed View and a Layer Hosting View in Core Animation?

What are the steps to setting up each and when is it appropriate to use either type?

like image 990
alfwatt Avatar asked Dec 09 '08 01:12

alfwatt


People also ask

What is Calayer in Swift?

An object that manages image-based content and allows you to perform animations on that content.

How layer animation is used in IOS?

Layer animations work much like view animations; you simply animate a property between a start and an end value over a defined period of time and let Core Animation take care of the rendering in between.


1 Answers

A layer backed view contains Cocoa or Cocoa Touch UI controls and can be animated using the animator proxy. Layer backed views allow you to animate your UI and help to reduce the overhead of drawing by caching the views contents on a core animation layer. Create a Layer backed view by setting the wants layer property:

NSView *layerBacked = [NSView new]; [layerBacked setWantsLayer:YES]; 

A layer hosting view provides a layer for direct manipulation hosted by an NSView or UIView. Layer hosting views can be used for embedding core animation drawing and animation anywhere you can put an NSView:

NSView *layerHosting = [NSView new]; [layerHosting setLayer:[[CALayer new] autorelease]]; [layerHosting setWantsLayer:YES]; 
like image 156
alfwatt Avatar answered Oct 18 '22 01:10

alfwatt