这里的iOS新手,但经过一些谷歌和教程的观察,我似乎找不出我已经搞砸了。我将尽力提供尽可能多的信息,我已经在我的UIMotionEffect子类(根控制器)中为UIViewController修改了一些代码。我的故事板包含一个UIViewcontroller子类(如下所示),它的视图包含一个UIImageView,即代码中的IBOutlet。一切都在运行,我的调试器点击了viewDidLoad:方法,但是移动我的手机并不能移动图像。任何帮助都将不胜感激!感谢您的阅读。
- (void)viewDidLoad
{
[super viewDidLoad];
CGFloat leftRightMin = -55.0f;
CGFloat leftRightMax = 55.0f;
UIInterpolatingMotionEffect *leftRight = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
leftRight.minimumRelativeValue = @(leftRightMin);
leftRight.maximumRelativeValue = @(leftRightMax);
UIMotionEffectGroup *moGroup = [[UIMotionEffectGroup alloc] init];
moGroup.motionEffects = @[leftRight];
[bgImageView addMotionEffect:moGroup];
}在同一类的头文件中.
@interface TabletMenuViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *bgImageView;
@end



发布于 2013-12-30 15:39:32
啊哈,发布时指出,在iPhone 4上没有视差和其他一些类似的功能。看起来我的开发手机太老了,而且已经坏了。
https://stackoverflow.com/questions/20820703
复制相似问题