この方法で s のUIInterpolatingMotionEffect
いくつかのビューにa を追加しています:UITableViewCell
UIInterpolatingMotionEffect *horizontalEffect = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
UIInterpolatingMotionEffect *verticalEffect = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
horizontalEffect.minimumRelativeValue = @(-horizontal);
horizontalEffect.maximumRelativeValue = @(horizontal);
verticalEffect.minimumRelativeValue = @(-vertical);
verticalEffect.maximumRelativeValue = @(vertical);
UIMotionEffectGroup *effectsGroup = [UIMotionEffectGroup new];
effectsGroup.motionEffects = @[horizontalEffect, verticalEffect];
[view addMotionEffect:effectsGroup];
問題は、効果がランダムにしか表示されず、効果が得られるビューと得られないビューがあることです。ビューコントローラーを押して戻った後、他のいくつかは機能し、他のいくつかは機能しません。
足りないものはありますか?セルを再利用するたびに効果を適用する必要がありますか?