iOS 13

AutoLayout Storyboard (Stack View를 활용한 간단한 오토레이아웃!)

iOS 에는 다양한 기기들이 존재합니다. iPhone11, 12처럼 notch가 있다거나, iPhone 8 처럼 없는 형식, 그리고 iPad도 존재합니다. 이러한 다양한 기기에 맞춰 따로따로 레이아웃을 설정해주고, 계산하기에는 너무 오랜시간이 걸릴 것 입니다. 그래서! 다양한 기기의 화면에 대응하기 위해 만들어진 Layout 엔진을 AutoLayout이라고 합니다. AutoLayout을 좀 더 깔끔하게 구현하기 위해 StackView라는 것이 존재합니다. StackView는 아래와 같이 두가지가 존재합니다. 가로로 나란히 놓을 수 있는 Horizontal Stack View, 세로로 나란히 놓을 수 있는 Vertical Stack View가 존재합니다. 위의 그림에는 어떠한 Stack View들이 사용되..

iOS 2020.12.07

UIGestureRecognizer (Swipe, Pan, ScreenEdgePan, Long Press)

UISwipeGestureRecognizer class UISwipeGestureRecognizer : UIGestureRecognizer UISwipeGestureRecognizer는 원하는 Swipe Gesture를 만들어 줘야 합니다. 예를들면 다음과 같이 작성할 수 있습니다. let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipeRight(_:))) swipeRight.direction = .right 전체적인 코드를 작성해 보면 다음과 같습니다. @IBOutlet var swipeView: UIView! override func viewDidLoad() { super.viewDidLoad() let..

iOS 2020.12.05

UIGestureRecognizer (Tap, Pinch, Rotation)

class UIGestureRecognizer : NSObject Gesture Recognizer Object 또는 Gesture Recognizer라는 것은 일련의 터치를 인식하고, 그 인식에 대한 어떠한 동작을 하는 객체입니다. 이 객체가 일련된 Gesture나, Gesture의 변경을 인식하면, 지정된 Target Object로 action message를 보내줍니다. UIGestureRecognizer의 Subclass는 다음과 같은 class가 존재합니다. UITapGestureRecognizer UIPinchGestureRecognizer UIRotationGestureRecognizer UISwipeGestureRecognizer UIPanGestureRecognizer UIScreenEd..

iOS 2020.12.03