2015-02-23 18 views
1

我正在尋找任何庫幫助我與視差效果控制器。IOS視差和PageControll

我需要頂部地圖(我的第一個控制器)和底部的頁面控件,帶有視差效果的可滾動頂部以及左右標準效果。

不知道如何做呢?

這與谷歌地圖應用(查找地點時)的效果相同。

+0

我不知道任何lib做到這一點。但是我發現了一些很棒的樣本來達到這些效果。看看http://www.thinkandbuild.it/implementing-the-twitter-ios-app-ui/。我希望它能幫助你。 – KIDdAe 2015-02-23 08:53:10

回答

-1

嗨,如果你想視差效果對你的看法。你應該使用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]; 
+0

是的,但這不是我能做到的。 – Unmerciful 2015-02-23 09:28:09