//this code can be used to rotate an image having both back and front
rotate = [UIButton buttonWithType:UIButtonTypeCustom];
[rotate addTarget:self action:@selector(rotate1)forControlEvents:UIControlEventTouchDown];
rotate.frame = CGRectMake(137.5, 245, 45, 46);
[rotate setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"viewing.png"]] forState:UIControlStateNormal];
[self.view addSubview:rotate];
int count;
count=0;
-(void)rotate1
{
count=count+1;
NSLog(@"rotate");
[UIView transitionWithView:imagecircle // use the forView: argument
duration:1 // use the setAnimationDuration: argument
options:UIViewAnimationOptionTransitionFlipFromLeft
// check UIViewAnimationOptions for what options you can use
animations:^{ // put the animation block here
imagecircle.image = imagecircle.image;
}
completion:NULL];
if(count%2==0)
{
NSLog(@"image.str.%@",appDelegate.imageNameString);
[imagecircle setImage:[UIImage imageNamed:appDelegate.imageNameString]];
[labellocation removeFromSuperview];
[labeldate removeFromSuperview];
[self.imagecircle addSubview:labelfrom];
}
else
{
[imagecircle setImage:[UIImage imageNamed:@"TGP_BACK.png"]];
[labelfrom removeFromSuperview];
[self.imagecircle addSubview:labellocation];
[self.imagecircle addSubview:labeldate];
}
}