Core Animation(Core Animation上に構築されたUIViewアニメーションモデル)は、あなたの友人です。 Time Machineのようなインターフェイスを、ビューを親ビュー(縦軸にcenter
プロパティを使用)で配置し、そのラインをさらに遠くに配置して、以下のものより少し小さくすることができますそれらのレイヤーのz-インデックスを設定する(ビューのlayer
プロパティを使用してレイヤーを取得し、次にzPosition
に設定する)ようにして、線の上にある線の上に表示されるようにします。ここにいくつかのサンプルコードがあります。
// animate an array of views into a stack at an offset position (0 has the first view in the stack at the front; higher values move "into" the stack)
// took the shortcut here of not setting the views' layers' z-indices; this will work if the backmost views are added first, but otherwise you'll need to set the zPosition values before doing this
int offset = 0;
[UIView animateWithDuration:0.3 animations:^{
CGFloat maxScale = 0.8; // frontmost visible view will be at 80% scale
CGFloat minScale = 0.2; // farthest-back view will be at 40% scale
CGFloat centerX = 160; // horizontal center
CGFloat frontCenterY = 280; // vertical center of frontmost visible view
CGFloat backCenterY = 80; // vertical center of farthest-back view
for(int i = 0; i < [viewStack count]; i++)
{
float distance = (float)(i - offset)/[viewStack count];
UIView *v = [viewStack objectAtIndex:i];
v.transform = CGAffineTransformMakeScale(maxScale + (minScale - maxScale) * distance, maxScale + (minScale - maxScale) * distance);
v.alpha = (i - offset > 0) ? (1 - distance) : 0; // views that have disappeared behind the screen get no opacity; views still visible fade as their distance increases
v.center = CGPointMake(centerX, frontCenterY + (backCenterY - frontCenterY) * distance);
}
}];
そして、ここではそれがランダムに色の景色のカップルと、次のようになります。
私の知る限り、カバーフローは2つだけのディメンションを使用して、サイド・ナビゲーションへの唯一の側面であります。したがって、それは私が探しているものではありませんが、とにかく感謝します。 – Glitch
CoverFlowはビューを左右にブラウズしています。タイムマシーンの注文は前面から後ろに向かっており、かなり違って見えます。 (これは意味がありますか?)http://www.macmacken.com/wp-content/files/timemachine_009.png –