Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IOS视差和页面控制_Ios_Parallax_Uipagecontrol - Fatal编程技术网

IOS视差和页面控制

IOS视差和页面控制,ios,parallax,uipagecontrol,Ios,Parallax,Uipagecontrol,我正在寻找任何库,帮助我使控制器与视差效果 我需要在顶部的地图(我的第一个控制器)和底部的页面控制,可滚动的视差效果顶部和左右的标准效果 知道怎么做吗 这与谷歌地图应用程序(在查找位置时)的效果相同。如果您希望在查看时具有视差效果,请稍候。您应该使用UIMotionEffects。此API将为您提供设置良好且易于管理的视差效果的机会。请记住,视差图像应该比原始图像大一点 // Set vertical effect UIInterpolatingMotionEffect *verticalMot

我正在寻找任何库,帮助我使控制器与视差效果

我需要在顶部的地图(我的第一个控制器)和底部的页面控制,可滚动的视差效果顶部和左右的标准效果

知道怎么做吗


这与谷歌地图应用程序(在查找位置时)的效果相同。

如果您希望在查看时具有视差效果,请稍候。您应该使用
UIMotionEffects
。此API将为您提供设置良好且易于管理的视差效果的机会。请记住,视差图像应该比原始图像大一点

// Set vertical effect
UIInterpolatingMotionEffect *verticalMotionEffect = 
  [[UIInterpolatingMotionEffect alloc] 
  initWithKeyPath:@"center.y"
             type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
verticalMotionEffect.minimumRelativeValue = @(-10);
verticalMotionEffect.maximumRelativeValue = @(10);

// Set horizontal effect 
UIInterpolatingMotionEffect *horizontalMotionEffect = 
  [[UIInterpolatingMotionEffect alloc] 
  initWithKeyPath:@"center.x"     
             type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
horizontalMotionEffect.minimumRelativeValue = @(-10);
horizontalMotionEffect.maximumRelativeValue = @(10);

// Create group to combine both
UIMotionEffectGroup *group = [UIMotionEffectGroup new];
group.motionEffects = @[horizontalMotionEffect, verticalMotionEffect];

// Add both effects to your view
[myBackgroundView addMotionEffect:group];

我不知道有什么办法来做这件事。但我已经找到了一些很好的样本来实现这些效果。看一看。我希望它能帮助你。是的,但我做不到。