2011-04-13 77 views

回答

2

我不知道我是否理解你的问题。如果你想知道一个UI元素的坐标,您的设备旋转后,这里是你如何做到这一点:

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 
{ 
    CGRect newFrame = someUIElement.frame; 
    int x = newFrame.origin.x;  // x-Coordinate 
    int y = newFrame.origin.y;  // y-Coordinate 
    // do stuff with coordinates 
} 
0

我有一些像费边回答边旋转首先调用方法的设备- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } 然后 - (空) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation时间:(NSTimeInterval)持续时间

终于

- (空)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 方法调用,所以你可以在这个method.The最主要的获取坐标这里是对象的来源将改变大小。这是我期望从一些示例应用程序的事情。

相关问题