Swift 학습 노트 vol.01
개시하다
9월부터 스위프트가 시작됐다.
나는 공부하는 필기를 썼다.
학습물
Swift - Photo Gallery App (StoryBoard + Actions & Outlets) pt. 1/5
http://youtu.be/ztIBNHOm35E
https://github.com/TDAbboud/PhotosGalleryApp
이번 성과물
이미지 갤러리를 만드는 첫걸음인 것 같아서요.
인터페이스를 유판에 놓다
ViewController 구성
Navigation Controller 구성
CollectionView를 PhotoCell로 정의
CollectionView에서 PhotoCell로 정의된 ImageView 구성
ImageView와 fullscreenView 연관
쇼 선택
NavigationItem을 View에 구성합니다.
전체 화면으로 UIImageView 구성
Coding
ViewPhoto 클래스 만들기
스트리밍 패널을 사용하여 ViewPort 클래스를 연결합니다.
작업 연결이 구성된 버튼
추가된 코드
ViewPhoto.swift
import UIKit
class ViewPhoto: UIViewController {
@IBAction func btnCancel(sender: AnyObject) {
println("Cancel")
self.navigationController?.popToRootViewControllerAnimated(true)
}
@IBAction func btnTrush(sender: AnyObject) {
println("trush")
}
@IBAction func btnExport(sender: AnyObject) {
println("Export")
}
@IBOutlet weak var ImgView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
ViewController 코드와 연결합니다.
ViewPhoto.swift
import UIKit
let reuseIdentifier = "PhotoCell"
class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
@IBOutlet var collectionView: UICollectionView!
@IBAction func btnCamera(sender: AnyObject) {
}
@IBAction func btnPhotoAlbum(sender: AnyObject) {
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// uicollectionViewDataSource method
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int{
return 1
}
// The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell{
let cell: UICollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as UICollectionViewCell
// modify the cell
cell.backgroundColor = UIColor.redColor()
return cell
}
}
앞으로
이번엔 파트1만 있고 앞으로도 계속 진행될 겁니다.
Reference
이 문제에 관하여(Swift 학습 노트 vol.01), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/kenjiSpecial@github/items/e17f9d081469eddd6498텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)