Reputation: 680
iOS newb here but after some googling and tutorial watching I can't seem to figure out where I've messed up. I'll try to provide as much info as possible, I've code monkeyed some code for the UIMotionEffect in my UIViewController subclass (root controller). My storyboard contains a UIViewcontroller subclass (below) with a view that contains a UIImageView that is the IBOutlet in the code. Everything runs and my debugger hits the viewDidLoad: method but moving my phone around doesn't move the image at all. Any help would be appreciated! Thanks for reading.
- (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];
}
In my header file for the same class...
@interface TabletMenuViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *bgImageView;
@end
Upvotes: 2
Views: 725
Reputation: 680
Ahah, per the release notes the parallax and some other similar features aren't available on the iPhone 4. Looks like my dev phone is too old and busted.
Upvotes: 5