로딩
요청 처리 중입니다...

iOS 흔들기(Shake) Test

 iOS 흔들기(Shake) Test

간단한 iOS 흔들기 테스트 앱을 만들어 봅시다. Xcode 실행 후 File > New > Project App을 선택후 아래쪽 Next버튼을 누릅니다.

Team과 Organization Identifier 부분은 개인에 맞게 작성하고 Next를 누릅니다. 파일 중 ViewContrller을 선택 후 다음처럼 내용을 추가합니다. import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?)

{ if motion == .motionShake { print("shake") let alert = UIAlertController(ti...

# iOS # motionend # shake # swift # swiftshake # 흔들기