Question

Good Day!

i want to ask that if i want to bring a uiview in front on another view, but i want to bring it by keeping its 1 points constant so that it looks like that only 1 (top) portion moved down. i put my uiview on 90 degrees but i could not figure out the way to bring it horizontal. here is code for uiview

clView.frame = CGRectMake(0,100,258,171);
clView.transform = CGAffineTransformIdentity;
clView.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
[self.view addSubview:clView];

Now it puts my view to 90 degrees but i could not bring it down with animation keeping one point constant. like projectile motion. Can somebody help me out ?

Yellow circle part i want to be still and other moving, 90 degress and back to normal

Yellow circle part i want to be still and other moving, 90 degress and back to normal

Was it helpful?

Solution

You probably want to set the anchorPoint of the underlying CALayer, to whatever coordinates represent the middle of the yellow circle. So something like:

myView.layer.anchorPoint = CGPointMake(x,y); // where x and y is the middle of the yellow circle.

Once you've set the anchorPoint, transforms will be done about that point.

This page has more detail on this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top