與其他應用程序非常相似,我的應用程序有一個「歡迎」頁面控制器,可快速瀏覽功能。在此概述,我畫中的UITabBar一樣,有一個圓形表演,其中的相關功能如下所示:在UIPageController中共享視圖的UIView動畫
我使用每一個頁面繪製時執行以下代碼繪製圓形:
double circleSize = 75;
[circleView removeFromSuperview];
circleView = [[UIView alloc] initWithFrame:CGRectMake(circleX,
circleY,
circleSize,
circleSize)];
circleView.layer.cornerRadius = (circleSize/2);
circleView.layer.borderColor = [UIColor VancityTransitBlue].CGColor;
circleView.layer.borderWidth = 2;
我希望這個圓圈看起來像「呼吸」(慢慢地增長,然後縮回原始大小)。我用的是確切的代碼從my answer to this question:
[UIView animateWithDuration:1
delay:0
options:UIViewKeyframeAnimationOptionAutoreverse | UIViewKeyframeAnimationOptionRepeat
animations:^{
circleView.transform = CGAffineTransformMakeScale(1.5, 1.5);
}
completion:nil];
這個圈子跨越三個網頁的頁面控制器的共享,並提請就好了。動畫在第一頁上工作得很好,定期在第二頁上工作,並且從不在第三頁上工作。
如何在每個頁面上爲每個圓圈視圖播放動畫?
如果我沒有提供足夠的代碼,或者您想看到其它的代碼,請隨時申請。 –
出於好奇,您如何在每個標籤欄項目中心上方定位'circleX'&'circleY'? – SwiftArchitect