答案 0 :(得分:1)
这很漂亮。它围绕一个点(顶部中心)旋转视图,然后改变算法旋转所需的时间,适当时反转。我不能给你代码,但我想如果你观看Hegarty教授的这个视频演示,你将拥有你需要的工具。他围绕视图外的一个点旋转 - 您可以简单地围绕视图边缘旋转(并且不缩小视图)。看看:
第1部分:http://www.stanford.edu/class/cs193p/cgi-bin/drupal/node/291
第2部分:http://www.stanford.edu/class/cs193p/cgi-bin/drupal/node/293
你肯定想从iTunes U(免费)下载视频,因为有很多解释。
祝你好运,达明
答案 1 :(得分:0)
我与作者联系并获悉它是使用Box2D物理库实现的。我要试一试。感谢您的回复!
答案 2 :(得分:0)
//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];
}
}