how to find the coordinates of an autoresizemasked object after rotation
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技巧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.
精彩评论