• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How expensive is it to neSt multipLE views?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How expensive is it to neSt multipLE views?


  • Subject: Re: How expensive is it to neSt multipLE views?
  • From: Uli Kusterer <email@hidden>
  • Date: Mon, 1 May 2006 21:48:46 +0200

Am 01.05.2006 um 05:54 schrieb Eric Lin:
In order to support animation of subviews, I'm strategically nesting my
subviews within multiple NSViews to simply the animation code (i.e. rather
then moving each component inidividually, I can move the whole parent view
at once). However, I'm wondering how expensive it is to extraneous NSViews
like this for no purpose other than supporting animation. Since I heard the
graphics context and all are pretty expensive to keep (and hence the need
for NSCell and all that).


The same effect could certainly be achieved with no parent view(s), ableit
with slightly more complex code.

Nobody can really tell you that for sure. It depends on what views you are using, how you're animating them, what computer with what graphics hardware they're running on etc. You're the only one who can really test this, because only you have your code and you only know what computers your program will run on and what speed you still find acceptable and ...


Just try the technique that seems cleanest to you. If that ends up as being too slow, you can always backup your original application and try to implement a solution that you think would be more efficient, and then compare the runtimes and performance of your applications.

 Here's a few different techniques to look into:

-> NSBitmapImageRep's initWithFocusedViewRect: (takes a "screen shot" of a certain view and its subviews which you can move or skew instead).

-> NSImage

-> NSScrollView: It does some drawing optimisations on newer MacOS X versions that are faster than trying to manually redraw stuff each time when you just need to animate movement.

-> borderless windows: On some Macs, a transparent and borderless window moves with GPU acceleration, and is thus actually faster than moving a view inside the window.

-> OpenGL: If you need the best animation performance, this is a very low-level but efficient API that can also be used for 2D graphics

Cheers,
-- M. Uli Kusterer
http://www.zathras.de


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Versioning and CoreData
  • Next by Date: Re: Versioning and CoreData
  • Previous by thread: Re: Core Data Speed (XML vs mySQL)
  • Next by thread: Re: Getting notified on tab-switch in Safari?
  • Index(es):
    • Date
    • Thread