Reputation: 1430
I wrote the code of a card game .. but now it's time todo the graphic and Interface
What's the best approach to represent a card ??
a) CALayer b) UIView c) UIButton
Which one is best to animate and receive user touches??? What do you recommend??
Thanks in advance
Upvotes: 2
Views: 346
Reputation: 17160
A UIView subclass would probably be your best choice. You can easily receive touch events from the user, and UIView allows you to do simple animations easily.
Upvotes: 1
Reputation: 9850
GeekGameBoard is older Apple-provided example code for card and board games that implements the UI in CALayers. Another user modified it to run on the iPhone so it might be helpful code for you to look at. The modified project is on bitbucket.
Upvotes: 2
Reputation: 6084
as UIButton is subclass of UIView, there's no so much difference in both of them. If you need only 'clicks' handling, you can choose button, if you will need to override touchesBegan/touchesMoved you should override UIView instead UIButton.
Upvotes: 1