I have a UIView on which i am loading my image view as a sub view. The image is showing when i doesn't set the anchor point but whenever i set anchor point the image is not showing .I have added the QUARTZCore frame work also.
I am adding my code below
CGRect apprect=CGRectMake(0, 0, 1024, 768);
UIView *containerView = [[UIView alloc] initWithFrame:apprect1];
containerView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:containerView];
handleView1= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"large.gif"]];
[handleView1 setAlpha:1];
//[handleView1 setFrame:CGRectMake(390, 172.00, 56.00, 316.00)];
handleView1.userInteractionEnabled = YES;
handleView1.layer.anchorPoint=CGPointMake(490.0, 172.0);
[containerView addSubview:handleView1];
Click and hold the mouse button on the Pen tool , then select the Pen tool , Add Anchor Point tool , or the Delete Anchor Point tool .
In the Edit mode, select a surface anchor. Then, tap on Settings in the upper-right corner and choose Anchor Type and this will take you into Image Anchor mode. From Image Anchor mode, select Type > Image at the bottom of the screen.
Anchor PointsSelect your image in the Timeline and click on the Anchor Point setting in the Effects Controls Panel; you will see a blue circle on the Anchor Point's image. To adjust the Anchor Point, either drag the blue circle or use the Effects Control Panel's numerical values.
The problem are the values you use for the anchorPoint. You don't set points like for the position of a frame as values. Let me quote Apple:
The anchorPoint property is a CGPoint that specifies a location within the bounds of a layer that corresponds with the position coordinate. The anchor point specifies how the bounds are positioned relative to the position property, as well as serving as the point that transforms are applied around. It is expressed in the unit coordinate system-the (0.0,0.0) value is located closest to the layer’s origin and (1.0,1.0) is located in the opposite corner.
Have a look at Layer Geometry and Transforms in the Core Animation Programming Guide for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With