본문 바로가기

프로그래밍/IOS

[IOS] 라이브러리에서 이미지 가져오기 :Getting from the photo library

728x90

#1. 목표

-  사진 라이브러리 혹은 카메라로 부터 이미지 가져오기


#2. 정리

1.  코드분석

- pickerController로 객체 생성

- image.delegate = self 란?

- 이미지 불러오는 타입 설정 : 카메라, 라이브러리


    @IBAction func importImage(sender: AnyObject) {

        let image = UIImagePickerController()

        image.delegate = self

        image.sourceType = UIImagePickerControllerSourceType.PhotoLibrary

        image.allowsEditing = false

        self.presentViewController(image, animated: true, completion: nil )

    }

2. 코드분석

- 이미지가 선택이 되면 화면이 사라지고 이미지 출력 하는 프로세스

func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {

        //print(" image selected")

        self.dismissViewControllerAnimated(true, completion: nil )

        importedImage.image = image

    }



가우넷 구름 USB 충전식 양면 대용량 보조배터리 손난로, 단일 상품, 화이트



"파트너스 활동을 통해 일정액의 수수료를 제공받을 수 있음"