On Feb 2, 2011, at 9:22 PM, Omar Hagopian wrote:

> Hi there!
> 
> I  am planning to implement a component similar to the iphone's photo album.. 
> I guess that using uviews will make the component to have a bad performace , 
> I mean scrolling slow and all of the stuff ... so which way should I take? Is 
> CALayer better than UIViews in terms of performance? Is there any other 
> (lighter) way to draw images or text without using UIView subclasses?
> 

With iOS and UIKit, all UIViews are backed by a CALayer. UIView merely provides 
convenient ways to render the content of the backing CALayer, and after that, 
all rendering to screen is provided by CALayer and the Quartz compositor which 
in turn uses OpenGL.

As long as the content of your UIView does not change frequently, there will be 
zero measurable performance difference between using UIView and using CALayer 
directly. That is because static images and text are rendered into the CALayer 
using whatever technique (OpenGL, Core Graphics, Core Image, Core Video, etc.) 
UIView and subclasses provide convenient methods to help you use OpenGL, Core 
Graphics, Core Image, Core Video, etc. and respond to events.

If the content of your UIView does change frequently, that means that the 
content of the CALayer must be re-rendered frequently. Depending on re-render 
frequency, OpenGL, Core Graphics, Core Image, or Core Video may be preferred 
over higher level API for performance reasons. CALayers are implemented as 
OpenGL texture buffers, and OpenGL benefits from hardware acceleration on 
iPhone/iPad/iPod Touch.  Therefore, OpenGL typically provides that absolute 
fastest rendering possible on the devices. However, OpenGL does not always 
produce the best quality output for a variety of reasons, so the trade-off 
becomes programmer productivity vs. quality of output vs. performance of 
rendering.

Note that Core Graphics, Core Image, and Core Video most likely are already 
substantially implemented using OpenGL.  IFAIK, text rendering in iOS doesn't 
use OpenGL except to provide the buffer for storing pixels. 


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to