开发者

how to find the coordinates of an autoresizemasked object after rotation

how to find the coordinates of an autoresizemasked object after rotation

Hi,

can we find the coordinates of a UI element say UItextfield which is masked after rotation, if yes how is it possible?

Thanx in advance

开发者_JAVA技巧

how to find the coordinates of an autoresizemasked object after rotation


I'm not sure whether I understand your question. If you want to know the coordinates of a UI element after your device was rotated, here's how you do it:

-(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
}


i have something like fabian answer while rotating the device first called method is - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } then -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

finally

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation method called so you can get the coordinates in this method.The main thing here is the object origin ll change not the size.this is the thing i am expecting from some sample app.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜