开发者

locationInView ignoring orientation

开发者 https://www.devze.com 2023-03-28 03:42 出处:网络
the coordinates returned by uitouch\'s locationInView are ignoring device orientation - I have a uiview that properly rotates, but locationInview always returns as if it is portrait...the view overr

the coordinates returned by uitouch's locationInView are ignoring device orientation -

I have a uiview that properly rotates, but locationInview always returns as if it is portrait...the view overrides layerClass and provides CAEAGLLay开发者_JAVA百科er but it is still a uiview

Is there something special I need to do? Or is it just standard practice to detect the orientation and manually adjust?

Thanks for any help/advice


Make sure you are using a ViewController for your host view. That should get the locationInView method to return orientation specific coordinates.


The view from which you are trying to get the CGPoint value is actually not getting resized, even though it might be getting oriented. Check its frame values before and after resize by:

NSLog(@"Rect Of View = %@",[[NSRectValue valueWithCGRect:yourView.frame] debugDescription]);
0

精彩评论

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