【发布时间】:2013-06-14 23:44:53
【问题描述】:
我正在尝试使用从 CMMotionManager 及其方法获得的值更改我的 UIView 的框架 - startDeviceMotionUpdatesToQueue:withHandler
我写了这样的草稿:
[_motionManager startDeviceMotionUpdatesToQueue:theQueue withHandler:^(CMDeviceMotion *motion, NSError *error) {
CGRect frame = _backgroundView.frame;
double x = motion.attitude.roll;
frame.origin.x = x*10;
[_backgroundView setFrame:frame];
}];
但我的观点根本不动。如果我记录我的框架,我可以在每次更新时看到变化......那么为什么我的视图没有在屏幕上移动?
【问题讨论】:
标签: ios objective-c core-motion cmmotionmanager