내가 주도권을 잡았으며 스크린 캐스트도 만들었습니다. Was this what you had in mind?
비디오를 캡처하는 것이 더 쉬워 지도록 애니메이션을 반복적으로 넣었지만 버튼을 누를 때 시작될 수 있으며 반전 될 때까지 팝업 및 그 내용을 표시 할 수 있습니다. 다시 숨겨지기.
CALayer의 마스크 속성을 사용하여 팝업을 숨기고 슬라이딩 애니메이션으로 나타 내기 위해 UIView에 애니메이션을 적용하는 대신 Core Animation을 사용했습니다.
- (void)viewDidLoad
{
// Declaring the popover layer
CALayer *popover = [CALayer layer];
CGFloat popoverHeight = 64.0f;
CGFloat popoverWidth = 200.0f;
popover.frame = CGRectMake(50.0f, 100.0f, popoverWidth, popoverHeight);
popover.contents = (id) [UIImage imageNamed:@"popover.png"].CGImage;
// Declaring the mask layer
CALayer *maskLayer = [CALayer layer];
maskLayer.frame = CGRectMake(0, - popoverHeight, popoverWidth, popoverHeight);
maskLayer.backgroundColor = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f].CGColor;
// Setting the animation (animates the mask layer)
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position.y"];
animation.byValue = [NSNumber numberWithFloat:popoverHeight];
animation.repeatCount = HUGE_VALF;
animation.duration = 2.0f;
[maskLayer addAnimation:animation forKey:@"position.y"];
//Assigning the animated maskLayer to the mask property of your popover
popover.mask = maskLayer;
[self.view.layer addSublayer:popover];
[super viewDidLoad];
}
참고 : 여기에
는 (비디오와 동일) 내가 사용하는 코드입니다 당신은 당신의 프로젝트에 QuartzCore 프레임 워크를 가져오고 헤더 파일에서이 줄을 작성해야합니다 :
#import <QuartzCore/QuartzCore.h>
합니다.
이 방법이 효과가 있는지 또는 더 이상 설정해야하는지 알려줍니다.
애니메이션을 반복해서 표시하지 않고 표시 한 후에 어떻게 추가 할 수 있습니까? 감사. –