我想鞋在iPhone的視圖兩點在iphone的視角中,Y軸相反,如何調整它像Y軸數學?
這是我的代碼
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];
這是中心,我得到的結果中心點(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];
這是點1,我設置了中心X:60 Y:60成
它應該是這個樣子的
但在模擬器上運行的是這樣的...
如何調整POINT1中心Y軸???
非常感謝
韋伯。
的可能重複[如何在上下文中繪製時翻轉座標?](http://stackoverflow.com/questions/1145595/how-to-flip-coordinates-when-drawing-in-context) –