を使用して垂直方向に変換される UIView があります
currentView.layer.affineTransform = CATransform3DGetAffineTransform(CATransform3DConcat(currentView.layer.transform,CATransform3DMakeRotation(M_PI, 1.0, 0.0, 0.0f)));
ここで、タッチを使用してこの UIView をある場所から別の場所に移動する必要があります。
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
}
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
}
しかし、私は変換を維持することができません。どうすればこれを達成できますか?
基本的に、次の呼び出しを使用して UIView にいくつかの UI 要素を追加しました
-(void)AddItemOnView:(UIView*)aView
Angle:(CGFloat)aDegree
XOrigin:(CGFloat)aXOrigin
YOrigin:(CGFloat)aYOrigin
Width:(CGFloat)aWidth
Height:(CGFloat)aHeight
FlipX:(CGFloat)aFlipHorrizontal
FlipY:(CGFloat)aFlipVerticle
{
UIView* currentView = aView;
if(currentView)
{
CGFloat angle = aDegree;
CGFloat flipHorrizontal = aFlipHorrizontal;
CGFloat flipVerticle = aFlipVerticle;
CGFloat xOrigin = aXOrigin;
CGFloat yOrigin = aYOrigin;
CGFloat width = aWidth;
CGFloat height = aHeight;
currentView.layer.anchorPoint = CGPointMake(0.0f, 0.0f);
currentView.frame = CGRectIntegral(CGRectMake(0, 0, width, height));
/* Flip The View Horrizontly*/
if(flipHorrizontal < 0)
{
/* Concat With previous Layer Operation */
currentView.layer.affineTransform = CATransform3DGetAffineTransform(CATransform3DConcat(currentView.layer.transform,CATransform3DMakeRotation(M_PI, 0.0, 1.0, 0.0f)));
/* Need to set anchor point ==> Top Right Corner */
currentView.layer.anchorPoint = CGPointMake(1.0f, 0.0f);
}
/* Flip The View Verticaly*/
if(flipVerticle < 0)
{
/* Concat With previous Layer Operation */
currentView.layer.affineTransform = CATransform3DGetAffineTransform(CATransform3DConcat(currentView.layer.transform,CATransform3DMakeRotation(M_PI, 1.0, 0.0, 0.0f)));
if(flipHorrizontal < 0)
{
/* This needs to set as we have already done flip X */
/* Need to set anchor point ==> Bottom Right Corner */
currentView.layer.anchorPoint = CGPointMake(1.0f, 1.0f);
}
else
{
/* Need to set anchor point ==> Bottom Left Corner */
currentView.layer.anchorPoint = CGPointMake(0.0f, 1.0f);
}
}
/* Perform Rotation */
if(angle != 0)
{
/* Concat With previous Layer Operation */
currentView.layer.affineTransform = CATransform3DGetAffineTransform(CATransform3DConcat(currentView.layer.transform,CATransform3DMakeRotation(DegreesToRadians(angle), 0, 0, 1.0)));
if(flipHorrizontal < 0 || flipVerticle < 0)
{
/* Countinue with previous anchor point */
}
else
{
/* Need to set anchor point ==> Top Left Corner */
currentView.layer.anchorPoint = CGPointMake(0.0f, 0.0f);
}
}
/* Set Origins of View */
currentView.layer.position = CGPointMake(xOrigin, yOrigin);
[self addSubview:currentView];
}
}
今、これらの追加されたUIViewを変換して移動しようとしています。