Saturday, 15 August 2015

objective c - How to add and move UIImages as a group -



objective c - How to add and move UIImages as a group -

i making board game , have question best way set in xcode.

i want able dynamically place pieces on board (each piece new image) , have user still able move board around. pieces need move board.

in storyboard have set uiimageview game board image , have given board custom class (extending uiimageview). figured add together pieces board through class , grouped same view board, didn't work.

so question more theoretical: best way set up? should add together pieces via main view controller, or through game model (an nsobject)? there way grouping new pieces (uiimages) board, can move together?

thanks in advance help.

since uiimageview subclass of uiview, can add together pieces board this:

[boardimageview addsubview:piece1];

then, when move board, of subviews of board move it.

note: default, won't able interact image view, create sure prepare that:

[boardimageview setuserinteractionenabled:yes]; // or set in storyboard/xib if using it.

objective-c model uiimageview uiimage

No comments:

Post a Comment