Re: The iPhone SDK OpenGL ES Application template

2009-07-22 Thread Wilson Chen
Thank you David for the tip!


On Wed, Jul 22, 2009 at 5:11 AM, David Duncan david.dun...@apple.comwrote:

 On Jul 21, 2009, at 10:18 AM, Wilson Chen wrote:

  My question is: since an EAGLView is a subclass of UIView, is there a
 particular reason for the template to not follow the common pattern to
 adhere the beloved MVC?



 There is really no difference in if you want to have the view controller or
 not. About the only thing to keep in mind is that if you do use a view
 controller, don't use the orientation change support.
 --
 David Duncan
 Apple DTS Animation and Printing


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


The iPhone SDK OpenGL ES Application template

2009-07-21 Thread Wilson Chen
Hi all,

For a typical iPhone application, after the application is finished
launching, the app delegate would then

1) create an instance of UIViewController;
2) ask the view controller for its view which the controller creates on
demand;
3) add the view as a subview of the window.

I really like this pattern since it adheres the MVC pattern. However, inside
the OpenGL ES Application XCode template, the EAGLView is added directly
to the window in the nib file, leaving the controller out.

My question is: since an EAGLView is a subclass of UIView, is there a
particular reason for the template to not follow the common pattern to
adhere the beloved MVC?

ciao,
wils
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


Why do CFType instances respond to NSObject messages?

2009-07-16 Thread Wilson Chen
Hi all,

I'm new to the Cocoa framework, and puzzled why the following code would
work:

CGLayerRef layer = ...assume we have a layer created.
printf(Retain count after creation: %i\n, CFGetRetainCount(layer));

[(NSObject*)layer retain];
printf(Retain count after sending a retain message: %i\n,
CFGetRetainCount(layer));

[(NSObject*)layer release];
printf(Retain count after sending a release message: %i\n,
CFGetRetainCount(layer));

The code above gives the following output:

Retain count after creation: 1
Retain count after sending a retain message: 2
Retain count after sending a release message: 1

Since a CGLayer is not a subclass of NSObject, its instances shouldn't
respond to retain/release messages. Yet the code works.

ciao,
wils
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com