复制iOS 7主屏幕动画

时间:2013-10-13 12:39:01

标签: objective-c animation ios7 homescreen

我想复制iOS 7主屏幕动画。大多数情况下,我有兴趣将滚动视图放大到特定点(如果图标在那里,中间或右上等,则在左上方)

http://www.youtube.com/watch?v=qBL8eQmQaVU

我以为我可以使用CGAffineTransformMakeScale,但我无法找到将其扩展到特定点的方法。有什么想法吗?

2 个答案:

答案 0 :(得分:2)

你可以使用动画块吗?在动画期间,您可以通过

渲染带有Scrollview内容的UIImage
UIGraphicsBeginImageContext(scrollView.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[scrollView.layer renderInContext:context];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

您可以将此图像作为图像视图(将图像视图的内容模式设置为调整大小以适应)覆盖现有内容,并使图像视图始终与滚动视图的大小相同。使它看起来像整个滚动视图正在调整大小。

这是动画块代码。

缩小

    scrollView.frame = icon.frame


    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationDelay:1.0];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];

    scrollview.frame = window.frame;

    [UIView commitAnimations];

放大

scrollView.frame = window.frame


    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationDelay:1.0];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];

    scrollview.frame = icon.frame;

    [UIView commitAnimations];

答案 1 :(得分:0)

您可以使用this源代码复制iOS主屏幕的大部分功能。