1

For a little project to become a more optimized efficient programmer for the upcoming iPhone game I'm making, I'm trying to make a user interactive interface, but it's difficult.

In my last question posted yesterday I asked about improving my ability to modify events of a UIImageView, and UIView to accept touches, (and it's working quite well!)

Though, the nice fellow then answered with even more helpful advice, UIView contains a .layers which contains CALayer, in which I'm trying to access the CALayer .contents to try to see if I can add an image manually to UIView using CGImageRef. I'm having difficulty in xcode for it to even recognize the layer properties.

So, I've come to a quite uninformed uneducated conclusion (hypothesis/guess/what-have-you) that if doesn't begin with a layer! But at the same time, that can't be the case, otherwise UIView wouldn't be able to handle a background color. Some help would be much appreciated!

Crosility
  • 111
  • 1
  • 7

2 Answers2

2

I'm having difficulty in xcode for it to even recognize the layer properties.

Make sure you #import <QuartzCore/QuartzCore.h>.

bosmacs
  • 7,341
  • 4
  • 31
  • 31
1

99% of the time, you won't need to care about that level of efficiency with cocoa touch UIView objects.

If you're that bothered about efficiency (you mentioned a game so I'm guessing lots of animating / images flying around etc) then I would start thinking about openGL. Luckily, you don't need to know much openGL to use it; take a look at cocos2d - it's a framework that's pretty popular.

Personally, I'd deal with this problem then they arise; normal cocoa touch UI objects are accelerated anyway so you might not run into any problems just using UIImageViews directly!

deanWombourne
  • 38,189
  • 13
  • 98
  • 110
  • Yea, I was speaking to my girlfriend about possibly just using UIImageViews and seeing if it can handle the possible 600+- objects. Thanks for the reassurance. :), it is helpful. – Crosility Aug 04 '11 at 17:40