Hello Friends facing this Problem:: Problem Definition:: I have to move the image sprites on the screen now when one of the image Sprite goes beyond limit i have to shuffle all of the UIImageView sprites.
My Code:
Basically Phase 1 that i'm doing is Shuffling:: that goes like this
tmpview = mapSRightImgView;
mapSRightImgView = mapFRightImgView;
mapFRightImgView = mapCenterImgView;
mapCenterImgView = mapFLeftImgView;
mapFLeftImgView = mapSLeftImgView;
mapSLeftImgView = tmpview;
now for time being i'm putting basck the removed sprite as the one to Second Left Image Sprite. Here [F-First & S-Second]
Now the Second Phase includes the shuffling of the images x-coordinates which i'm storing in an array:
for (int i = 0; i<4; i++)
{
value_Array = [image_x objectAtIndex:(i+1)];
NSLog(@"Values in image_x at index::%d are::%f",i,value_Array.floatValue);
[image_x replaceObjectAtIndex:i withObject:value_Array];
if( i == 3)
{
value_Array = [image_x objectAtIndex:(i+1)];
tmpValue = value_Array.floatValue;
value_Array = [NSNumber numberWithFloat:(tmpValue+340)];
NSLog(@"Values in image_x at index::%d are::%f",(i+1),value_Array.floatValue);
[image_x replaceObjectAtIndex:(i+1) withObject:value_Array];
}
}
Now I'm doing is calling [self setNeedsDisplay];
The problem is that after all this the result is some what messy and disgusting.
Is there any simpler way of achieving this kind of arrangement. Please friends help me>>>