[IOS] UIInterpolatingMotionEffect: Poor gravity vision, uimotioneffect
-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self. view. backgroundColor = [UIColor grayColor]; UIView * view = [[UIView alloc] initWithFrame: self. view. bounds]; view. backgroundColor = [UIColor blueColor]; view. layer. borderColor = [[UIColor greenColor] CGColor]; view. layer. borderWidth = 5.0; [self. view addSubview: view]; // create the offset UIInterpolatingMotionEffect * effectX = [[UIInterpolatingMotionEffect alloc] initWithKeyPath: @ "center. x "type: UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; UIInterpolatingMotionEffect * effectY = [[UIInterpolatingMotionEffect alloc] initWithKeyPath: @" center. y "type: UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; // you can specify the maximum and minimum values of effectX. maximumRelativeValue = @ (100); optional Tx. minimumRelativeValue = @ (-100); ty. maximumRelativeValue = @ (100); ty. minimumRelativeValue = @ (-100); [view addMotionEffect: Release TX]; [view addMotionEffect: Release ty];}
Initial
After tilting the screen