How can I use picker view in iphone application us

2020-05-07 05:07发布

问题:

I am working on a project ( Slots Game ) using cocos2d. I need to add picker view to rotate the reel ( image chain ). But I can not doing this rotation.If you have a solution for this please give me the instruction that how can I do this using picker view or without picker view. Please ans me with help instruction.

回答1:

Cocos2d isn't a .nib file. There is no easy "picker view." If you can't make this distinction cocos2d is gonna be more trouble than it's worth.

Instead you should probably animate a spinning wheel, and then a static image of each symbol on the wheel. Make these into a class. Add three to the layer where they live, and then once the lever or whatever is pulled tell them to go into the spin mode, then wait, then go into a static image defined by a random() call or something.



回答2:

If I'm reading this correctly... you want to use UIPicker to simulate a slot machine cylinder?

If so, trust me, that is WAY more trouble than it is worth. That is far more customization that UIPicker was ever meant to support. Make your own spinning wheel, it will be easier, and you'll learn more useful lessons (rather than arcane subclassing tricks to fool UIPicker, which you will likely NEVER do again).



回答3:

I am also working on a project that is based on slot machine. i have tried to manipulate UIPicker but this is unable to get what the exactly slot machine looks like, so i have decided to use UIScrollView and UIImageView. This comes out great, working fine, we need to only navigate the images as we want.

For random number i have created a class that generate the random number as per my algorithm.

Thanks, Abu