clamp
Clamp
clamp
글쓰기 관리
전체 방문자
오늘
어제
  • 분류 전체보기 (509)
    • IOS (85)
    • SwiftUI+TCA+Combine (9)
    • RxSwift + MVVM (56)
    • Clean Architecture (12)
    • SWIFT (56)
    • iOS - TDD (2)
    • 디자인패턴 (4)
    • CS (56)
      • 알고리즘 (29)
      • 운영체제 (15)
      • 자료구조 (2)
      • 네트워킹 (4)
      • 기타 (6)
    • 회고 (0)
    • Firebase (18)
    • SwiftUI (10)
    • iOS - UIKit (11)
    • iOS - 오픈소스 (6)
    • 코딩테스트 (166)
      • 프로그래머스 (164)
    • 정보처리기사 (14)
    • GitHub (2)
글쓰기 / 관리자

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • ㅅ
  • Q
  • Swift
  • uikit

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
clamp

Clamp

iOS - UIKit

[iOS] UIImagePicker

2023. 4. 11. 16:27

UIImagePicker

// 버튼이 눌리면 이미지 피커가 떠오르도록
@objc func handleProfilePhotoSelect(){
        //이미지 피커 설정
        let picker = UIImagePickerController()
        picker.delegate = self
        picker.allowsEditing = true
        
        present(picker, animated: true, completion: nil)
    }

ImagePickerDelegate

extension RegistrationController: UIImagePickerControllerDelegate{
// 이미지피커 선택이 완료되면 전달되는 델리게이트
    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
        
        // 이미지를 받아와서 plusPhotoButton의 Image로
        guard let selectedImage = info[.editedImage] as? UIImage else { return }
        
        plusPhotoButton.layer.cornerRadius = plusPhotoButton.frame.width / 2
        // 정하여 sublayer의 모서리를 둥글게 만들 경우, masksToBounds가 true로 설정되어있지 않으면 sublayer의 둥근 부분이 경계를 벗어나서 잘리지 않고 그대로 보여지게 됩니다.
        plusPhotoButton.layer.masksToBounds = true
        plusPhotoButton.layer.borderColor = UIColor.white.cgColor
        plusPhotoButton.layer.borderWidth = 2
        plusPhotoButton.setImage(selectedImage.withRenderingMode(.alwaysOriginal), for: .normal)
        
        self.dismiss(animated: true, completion: nil)
    }
저작자표시 비영리 동일조건 (새창열림)
    'iOS - UIKit' 카테고리의 다른 글
    • [iOS - UIKit] StackView를 알아보자
    • [UIKit] UISlider
    • [UIKit] UICollectionView
    • UIKit - UITextfield
    clamp
    clamp
    주니어 iOS개발자의 발악!!!!!!!

    티스토리툴바