본문 바로가기

Swift 35

[xcode8, Swift 3] UIImageView 에서 탭제스처를 이용해서 가운데 위치 시키기 사전 학습[xcode8, Swift 3] UIScrollView 에서 UIImageView 적용하고 이미지 줌인, 줌아웃 "UIScrollView 에서 UIImageView 적용하고 이미지 줌인, 줌아웃" 글에서 작성한 프로젝트에 Tap Gesture 를 이용해서 선택한 영역을 UIScrollView의 가운데 위치 하도록 코드를 추가할 것입니다. 개발 환경 xcode8, Swift 3 코드 작성 ViewController.swift 파일의 viewDidLoad() 에 다음 코드를 추가한다. override func viewDidLoad() { ... //ImageView의 TabGesture 인식 시킨다.imageView.isUserInteractionEnabled = truelet tapGesture .. 2017. 1. 4.
[xcode8, Swift 3] UIScrollView 에서 UIImageView 적용하고 이미지 줌인, 줌아웃 xcode8에서 Swift 3을 이용해서 UIScrollView의 하위 View로 UIImageView 객체를 동적으로 생성한 후에 Pinch Gesture 로 이미지를 줌인, 줌아웃하는 앱을 개발해 보려고 합니다. 개발 환경xcode8, Swift3 프로젝트 생성 Project navigator 에서 Main.storyboard 파일을 선택한다. Object library 창에서 UIScrollView 객체를 끓어다가 ViewController 위에 놓는다. 메뉴 View>Assistant Editor>Show Assistant Editor 를 선택해서 ViewController.swift 를 에디터로 연다. Ctrl+UIScrollView 클릭, 드래그 해서 ViewController.swift 파일.. 2017. 1. 3.
[ iOS 9.x -> iOS 10 ] autoresizingMask 설정법 rotate시에 ScrollView의 규격을 그대로 유지하기 위한 설정 방법 [출처] ios UITableView Cell을 dequeueReusableCellWithIdentifier 통해서 조회할때 항상 nil ???|작성자 달망망이 iOS 9.x scrollView.autoresizingMask = .FlexibleWidth | .FlexibleHeight iOS 10 scrollView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 2016. 12. 23.
[xcode 8, Swift 3] 경고(Alert)창 띄우기 개발환경xcode 8, Swift 3 코드let dialog = UIAlertController(title: "제목", message: "내용", preferredStyle: .alert) let action = UIAlertAction(title: "확인", style: UIAlertActionStyle.default)dialog.addAction(action) self.present(dialog, animated: true, completion: nil) 버튼을 눌렀을 때, 작업을 하기 원하면 아래와 같이 let action = UIAlertAction(title: "확인", style: UIAlertActionStyle.default){ (action: UIAlertAction) -> Void in.. 2016. 12. 22.
Swift 3.0 에서 달라지거나 새로워진 내용들 enums 와 속성들을 위해 UpperCamelCase 가 lowerCamelCase 로 대체 되었습니다.Swift 2.2는 NSURLRequest (URL : someURL)를 사용하여 NSURLRequest 객체를 생성했습니다.Swift 3 에서는 이것을 URLRequest (url : someURL)로 다시 작성되었습니다. webView.request?.url?.absoluteString 을 이용해서 webView의 URL을 읽을 수 있다. 참고 : What's new in Swift 3.0 2016. 12. 3.