有没有类似OnOrientationChanged的方法?
是否有像 protected override void OnOrientationChanged(OrientationChangedEventArgs e)
这样的方法在 SupportedOrientations="Portrait"
时有效?
我想做的是实现一些手势,例如:
- 用户将手机旋转到横向左侧位置,并执行一些代码
- 用户将手机旋转到横向右侧位置,并执行其他一些代码
我的应用程序是 PortraitUp 导向的。当我设置 SupportedOrientations="PortraitOrLandscape"
时,内容开始旋转。
或者也许我应该使用加速度计来处理手机位置?
Is there a method like protected override void OnOrientationChanged(OrientationChangedEventArgs e)
which works when SupportedOrientations="Portrait"
?
What I'm trying to do is to implement some gestures like:
- User rotates phone to landscape left position and some code is executed
- User rotates phone to landscape right position and some another code is executed
My app is PortraitUp orientated. When I set SupportedOrientations="PortraitOrLandscape"
the content starts to rotate.
Or perhaps should I use accelerometer to handle phone position?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您正在寻找加速度计,codeplex 上几乎没有可用的帮助程序,这可能会给您带来帮助:
http:// /accelerometer.codeplex.com/ - 用于了解加速度计发生情况的视觉辅助
http://phone7actionpack.codeplex.com/ - 包括手机旋转时更改视觉状态行为。
It sounds like you're after the accelerometer, there are few helpers available on codeplex which may give you a leg up:
http://accelerometer.codeplex.com/ - visual aid for understanding what's going on with the accelerometer
http://phone7actionpack.codeplex.com/ - includes a change visual state behavior when the phone rotates.
听起来您正在执行“OnOrientationChangedToLandscapeLeft”类型事件(以及类似事件)。
这并不存在,但您可以使用现有的内容自行创建。
在
OnOrientaionChanged
事件中,您可以通过检查e
参数来检测屏幕旋转方向,然后相应地执行相关代码。像这样的东西:
It sounds like you're after a "OnOrientationChangedToLandscapeLeft" type event (and similar).
This doesn't exist but you can create this yourself with what does exist.
Within the
OnOrientaionChanged
event you can detect which way the screen is rotated by checking thee
argument and then executing relevant code accordingly.Something like: