본문 바로가기

나의 플랫폼/iOS

[iOS][Animation] 혹시 CAKeyframeAnimation이 동작하지 않을때 CAKeyframeAnimation을 사용하여 잘 동작을 하다가,백그라운드에서 포그라운드로 이동할 경우Animation이 멈춰버리는 현상이 발생 animation.isRemovedOnCompletion = false 위와 같이 Animation에 isRemovedOnCompletions에 false를 줘보세요~ DiscussionWhen true, the animation is removed from the target layer’s animations once its active duration has passed. Defaults to true.https://developer.apple.com/reference/quartzcore/caanimation/1412458-isremovedoncompleti.. 더보기
[iOS][Animation] UIView resume, pause 애니메이션을 정지 했다가 다시 돌리는 함수를 공유 하고자 합니다. 1234567891011121314func pauseLayer(layer: CALayer) { let pausedTime = layer.convertTime(CACurrentMediaTime(), from: nil) layer.speed = 0.0 layer.timeOffset = pausedTime } func resumeLayer(layer: CALayer) { let pausedTime = layer.timeOffset layer.speed = 1.0 layer.timeOffset = 0.0 layer.beginTime = 0.0 let timeSincePause = layer.convertTime(CACurrentMediaTime(.. 더보기
[iOS] 백그라운드, 포그라운드 확인 iOS는 전혀 App이 Background 인지 Foreground 인지 지원 알려주는 함수가 있다. AppDelegate.swift를 보시면 func applicationDidEnterBackground(_ application: UIApplication) {}func applicationWillEnterForeground(_ application: UIApplication) { } 위 두 함수를 통해서 파악을 할 수 있다! 하지만 이건 AppDelegate 인데, ViewController에서 어떻게 콜백을 받냐??구글링 해보면 여러가지가 있는데요. 그중에서 전 NotificationCenter를 이용하면 아주 쉽게 콜백을 받을 수 있습니다. 12345678910111213141516171819ove.. 더보기
[iOS][Swift] Navigation bar 숨기기 ## Storyboard 파일에서 http://stackoverflow.com/a/27616077 ## Programmatically navigationController?.isNavigationBarHidden = truenavigationController?.isNavigationBarHidden = false 더보기
[iOS][Swift] NavigationController 화면 전환 시 애니메이션 ## CATransition 이용 let transition = CATransition() transition.duration = 0.3 transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) transition.type = kCATransitionFade self.navigationController?.view.layer.add(transition, forKey: nil) self.navigationController?.pushViewController(targetViewController, animated: false) ## UIView Aniamtion 이용UIView.animate(wit.. 더보기
[iOS] Assets 에 저장할 이미지 변경 iOS는 한 이미지에 대해 3가지 형태가 필요하다. According to my understanding, if the image size is 100 * 100@1x -> 100 * 100@2x -> 200 * 200@3x -> 300 * 300참고 : http://stackoverflow.com/a/36515093 그래서 혹시 Android Assets Studio 같은 프로그램이 iOS에서도 있을까 하고 찾아본 결과Prepo 라는 앱을 발견 하게 되었다.다운로드 : https://wearemothership.com/work/prepo/ 위 앱을 다운 받고 Prepo 앱에서 이미지를 넣으면 3가지 형태로 뽑을 수 있다. icon은 icons 탭을 클릭하여 사용 하시면 되고,이미지 같은 경우 Artwo.. 더보기
[iOS] 해킨토시 설치 윈도우에 Mac OS X를 사용 하는 방법은 해킨 토시를 이용 하는 것 이다. 즉, Vmware나 VirtualBox를 이용하여 가상 OS를 이용하는 방법 이다.아래 두 링크를 이용하면 된다. Vmware : http://www.wikigain.com/install-macos-sierra-10-12-vmware/VirtualBox : http://www.wikigain.com/install-macos-sierra-10-12-virtualbox/ VirtualBox는 GPLv2 오픈 라이센스라 사용을 많이 하는 편인데...가끔 하드웨어에 따라 동작을 안할 경우가 있다. 특히, 아래 와 같은 에러 로그가 나올 경우 포기 하는게 더 빠르더라.Changing the VM state from 'RUNNING' t.. 더보기
[Swift] 스위프트 테스트 사이트 Swift를 공부하면서 간단하게 테스트 해볼 수 있는 사이트를 찾는 도중괜찮은 사이트가 있어서 공유 합니다. 참고하세요. https://iswift.org/playground 더보기