import UIKit import AVFoundation class ViewController: UIViewController { /// 캡쳐동작 구성. 입력에서 출력으로 데이터 흐름 제어 let captureSession = AVCaptureSession() var videoDevice: AVCaptureDevice! var videoInput: AVCaptureDeviceInput! var audioInput: AVCaptureDeviceInput! var videoOutput: AVCaptureMovieFileOutput! /// 카메라 입력 화면 lazy var previewLayer = AVCaptureVideoPreviewLayer(session: self.captureSession) ///..
ios AVPlayerLayer 사용해보기 import UIKit import AVFoundation class ViewController: UIViewController { @IBOutlet weak var videoView: UIView! var player = AVPlayer() var playerLayer = AVPlayerLayer() var isVideoPlaying = false @IBOutlet weak var playButton: UIButton! @IBOutlet weak var currentTimeLabel: UILabel! @IBOutlet weak var durationLabel: UILabel! @IBOutlet weak var timeSlider: UISlider! overri..
ios UIBezierPath 연습 2 (파이차트 그리기) 기본개념: 반지름이 1이라면 원주의 길이는 2π 가 된다. 반지름이 1인 원의 원주의 길이는 2π이라는 말은 즉, 360도는 2π이다. 180도의 원주의 길이는 π가된다. 각도를 라디안으로 변경하는 공식 도 * 3.14 / 180 자주 사용하는 공식 30도 = π/6 45도 = π/4 60도 = π/3 270도 = 4.71238898038469 90도(.pi / 2) = = 1.570796326794897 360(2π) = 6.283185307179586 import UIKit @IBDesignable class CircleView: UIView { override func draw(_ rect: CGRect) { /// 파이차트 만들기 self..
ios UIBezierPath 연습 1 (원그리기, 호그리기,선그리기) import UIKit @IBDesignable class LineView: UIView { //@IBInspectable var lineCount:Int = 10 //5 간격 var divid = 10.0 var width = 0.0 var height = 0.0 override func draw(_ rect: CGRect) { width = bounds.width height = bounds.height // 300, 300 print("view width : \(width)") print("view height : \(height)") let linePath = UIBezierPath() //[1] 세로 300 y축 10의 간격..
ios 코어 그래픽 1 Core Graphics에서 도형을 그리려면 Core Graphics에 추적할 선(예: 더하기를 위한 두 개의 직선) 또는 채울 선(예: 원)을 알려주는 경로를 정의합니다. 경로에 대해 알아야 할 세 가지 기본 사항이 있습니다. 1.Path는 획을 그어 채울 수 있습니다. 2.획은 현재 획 색상으로 패스의 윤곽을 그립니다. 3.채우기(fill)는 현재 채우기 색상으로 닫힌 경로를 채웁니다. Core Graphics 경로를 만드는 쉬운 방법은 UIBezierPath라는 편리한 클래스입니다. 이 클래스를 사용하면 사용자에게 친숙한 API로 경로를 개발할 수 있습니다. 경로는 선, 곡선, 직사각형 또는 일련의 연결된 점을 기반으로 할 수 있습니다. +- 버튼 코드 import UIKit..