UINavigation 의 push 애니메이션 효과를 코드로 적용하는 방법.
#import <QuartzCore/QuartzCore.h>
-----------------------------------------------------
- (void)showNextView {
[self.view addSubview:nextView];
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[self.view layer] addAnimation:animation forKey:@"SlideView"];
}
- (void)hideNextView {
[nextView removeFromSuperview];
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[self.view layer] addAnimation:animation forKey:@"SlideView"];
}
반응형
'Programming > iOS - ObjC' 카테고리의 다른 글
Layer - 그림자 넣기 (0) | 2017.03.19 |
---|---|
[APNs] Push notification 등록 (iOS10 대응) (0) | 2016.12.11 |
ObjectiveC와 Javascript 상호 호출 (0) | 2015.07.09 |
UILabel - 특정 범위 색상 변경 (0) | 2015.07.09 |
Device type check (0) | 2015.07.09 |
UIAlertView - TextField 추가 (0) | 2015.07.09 |
NSString - Base64 Encoding/Decoding (0) | 2015.06.30 |
UISwitch - 상태값 가져오기 (0) | 2014.12.04 |
MPMoviePlayerController - 비디오 재생 (0) | 2014.12.04 |
MPMoviePlayerController - 오디오 스트리밍 재생 (0) | 2014.12.04 |