开发者

Y-axis opposite in iphone's view , how to adjust it like Y-axis mathematics?

I wanna shoe two point in a iphone's view

This is my code

UIImageView *center;
center = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"point.png"]];
[center setFrame:CGRectMake(0, 0, 10, 10)];
float r_rect_center_x = [r_img frame].size.width/2;
float r_rect_center_开发者_开发百科y = [r_img frame].size.height/2;
[center setCenter:CGPointMake(r_rect_center_x,r_rect_center_y)];
[r_img addSubview:center];
[center release];

This is center, I got result center point is (X:50,Y:60)

float point1_x = 60.0f;
float point1_y = 60.0f;
UIImageView *point1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"point.png"]];
[point1 setFrame:CGRectMake(0, 0, 10, 10)];
[point1 setCenter:CGPointMake(point1_x,point1_y)];
[r_img addSubview:point1];
[point1 release];

This is point1 , I set the center is X:60,Y:60

It should be looks like this

Y-axis opposite in iphone's view , how to adjust it like Y-axis mathematics?

But it run on the simulator is like this...

Y-axis opposite in iphone's view , how to adjust it like Y-axis mathematics?

HOW TO ADJUST THE POINT1 CENTER IN Y-AXIS ???

Many Thanks

Webber.


There's a setFlipped: method on the view. Just call it and pass YES.

[view setFlipped:YES]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜