I have written some code to rotate a imageview 90 degrees and then flip it. However the flip seems to cut off half the image. Why does this happen?
UIImageView *tempView = [[UIImageView alloc] initWithFrame:button.frame];
tempView.image = [UIImage imageNamed:@"propertyCard.png"];
//tempView.backgroundColor = [UIColor redColor];
tempView.opaque = YES;
[self.view addSubview:tempView];
[UIView animateWithDuration: 1
delay: 0
options: UIViewAnimationOptionBeginFromCurrentState
animations:^{
// rotate
tempView.layer.transform = CATransform3DMakeRotation(M_PI /2, 0., 0, 1);
}
completion:^(BOOL finished) {
[self showPropertyViews];
[UIView animateWithDuration: 1
delay: 0
options: UIViewAnimationOptionBeginFromCurrentState
animations:^{
// flip
tempView.layer.transform = CATransform3DMakeRotation(M_PI, 1.0,1.0,0.0);
}
completion:^(BOOL finished) {
[UIView animateWithDu开发者_如何学JAVAration: 1
delay: 0
options: UIViewAnimationOptionBeginFromCurrentState
animations:^{
tempView.frame = CGRectMake(propertyView.frame.origin.y + 12, propertyView.frame.origin.x +12, propertyView.frame.size.height-20, propertyView.frame.size.width-20);
tempView.center = propertyView.center;
}
completion:^(BOOL finished) {
tempView.hidden = YES;
propertyView.hidden = NO;
propertyView.alpha = 1;
[self displayCoverFlow];
[tempView removeFromSuperview];
[tempView release];
}];
}];
}];
When your view is turned nearly perpendicular to the screen, the more distant half will be covered by some of your other view in the view hierarchy. Try to set some "enough big" Z value for the view being animated, for example:
myView.layer.zPosition = 1000.0;
精彩评论