Custom menus, buttons and UI elements

Posts: 9
Joined: 2008.10
Post: #1
Hi, when developing a game, it's common to want your menus, buttons, and other UI elements to have your own look and feel, rather than looking like the standard application UI elements provided by the SDK.

Whats the best way to achieve this? Usually you just want to have UI elements that use your own image files as a "skin".

Do you draw your own CALayers or UIImageViews, and then handle touches and menuing in your own code? Or is there a way to take the standard classes for UI elements (UIButton, TableViews, NavBar, etc), and completely override their appearance, but retain their function?
Quote this message in a reply
Posts: 509
Joined: 2002.09
Post: #2
Make one UIView and draw all you images onto it by using the drawAtRect or drawAtPoint method.

If you wanna use Core Animation, you can either create CALayer instances and add them to the UIView's layer as sublayers. Or you can create subviews which already have a CALayer.

Also take a look at the CGImage API which has some cool functions.

"When you dream, there are no rules..."
Quote this message in a reply
Posts: 9
Joined: 2008.10
Post: #3
Ok thanks. So you recommend doing the touch, scrolling, button press etc functionality in your own code, and just work with pure CALayers?
Quote this message in a reply
Posts: 133
Joined: 2008.05
Post: #4
You should be overriding the drawRect: method in a subclass to create custom appearing interface elements.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Attempting to add landscape IB buttons to an openGL View Madrayken 1 4,999 Oct 17, 2010 07:03 AM
Last Post: iamflimflam1
  Anyone using Cocoa Touch for menus? johncmurphy 9 7,422 Dec 22, 2009 10:08 AM
Last Post: AnotherJake
  2D Control Buttons on Top of 3D OpenGl. Bersaelor 1 5,726 Sep 23, 2009 09:56 AM
Last Post: Skorche
  How do I misuse volume buttons? jaber 15 10,947 Aug 26, 2009 11:24 AM
Last Post: Frank C.
  Translucent buttons 9livesoftware 0 3,376 Aug 8, 2009 03:27 PM
Last Post: 9livesoftware