Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I set the anchor point, my image is not loading

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];
like image 475
Lena Avatar asked May 11 '11 07:05

Lena


People also ask

How do I add an anchor point to a photo?

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 .

How do I anchor an image in Photoshop?

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.

How do I anchor an image in Premiere?

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.


1 Answers

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.

enter image description here

Have a look at Layer Geometry and Transforms in the Core Animation Programming Guide for more details.

like image 127
Nick Weaver Avatar answered Sep 27 '22 15:09

Nick Weaver