diff --git a/SpaceCapsule/SpaceCapsule/Manager/KingReceiver/Extensions/KingReceiver+UIImageView.swift b/SpaceCapsule/SpaceCapsule/Manager/KingReceiver/Extensions/KingReceiver+UIImageView.swift index 0f26f62..bdda65c 100644 --- a/SpaceCapsule/SpaceCapsule/Manager/KingReceiver/Extensions/KingReceiver+UIImageView.swift +++ b/SpaceCapsule/SpaceCapsule/Manager/KingReceiver/Extensions/KingReceiver+UIImageView.swift @@ -46,8 +46,13 @@ extension KingReceiverWrapper where Base: UIImageView { } } - func setImage(with data: Data, placeholder: UIImage? = nil, width: CGFloat, scale: CGFloat = 1) { - guard let image = UIImage.resize(data: data, to: base.frame.size, scale: scale) else { + func setImage( + with data: Data, + placeholder: UIImage? = nil, + to targetSize: CGSize, + scale: CGFloat = 1 + ) { + guard let image = UIImage.resize(data: data, to: targetSize, scale: scale) else { base.image = placeholder return } diff --git a/SpaceCapsule/SpaceCapsule/Manager/KingReceiver/Extensions/UIImage+resize.swift b/SpaceCapsule/SpaceCapsule/Manager/KingReceiver/Extensions/UIImage+resize.swift index 725ad95..788f3ab 100644 --- a/SpaceCapsule/SpaceCapsule/Manager/KingReceiver/Extensions/UIImage+resize.swift +++ b/SpaceCapsule/SpaceCapsule/Manager/KingReceiver/Extensions/UIImage+resize.swift @@ -21,8 +21,9 @@ extension UIImage { kCGImageSourceCreateThumbnailWithTransform: true, kCGImageSourceThumbnailMaxPixelSize: maxDimension, ] as CFDictionary - + guard let resizedImage = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, resizingOptions) else { + print("resized error") return nil } diff --git a/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/CapsuleCreateView.swift b/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/CapsuleCreateView.swift index bac2ac4..d19900a 100644 --- a/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/CapsuleCreateView.swift +++ b/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/CapsuleCreateView.swift @@ -36,8 +36,7 @@ final class CapsuleCreateView: UIView, BaseView { let titleTextField: ThemeTextField = { let textField = ThemeTextField(placeholder: "추억하고 싶은 캡슐의 이름을 적어주세요 (최대 15자)") - - + return textField }() diff --git a/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/CapsuleCreateViewController.swift b/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/CapsuleCreateViewController.swift index 7ca6ba0..9758a6d 100644 --- a/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/CapsuleCreateViewController.swift +++ b/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/CapsuleCreateViewController.swift @@ -44,14 +44,7 @@ final class CapsuleCreateViewController: UIViewController, BaseViewController { setUpNavigation() addSubViews() makeConstraints() - - mainView.titleTextField.delegate = self - - mainView.imageCollectionView.applyDataSource() - - addTapGestureRecognizer() - scrollView.addKeyboardNotification() - + configure() bind() } @@ -62,6 +55,13 @@ final class CapsuleCreateViewController: UIViewController, BaseViewController { scrollView.removeKeyboardNotification() } + private func configure() { + mainView.titleTextField.delegate = self + mainView.imageCollectionView.applyDataSource() + addTapGestureRecognizer() + scrollView.addKeyboardNotification() + } + func bind() { closeButton.rx.tap .withUnretained(self) diff --git a/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/Components/AddImageCell.swift b/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/Components/AddImageCell.swift index 1cb6721..f536e71 100644 --- a/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/Components/AddImageCell.swift +++ b/SpaceCapsule/SpaceCapsule/Scene/TabBar/CapsuleAdd/CapsuleCreate/Components/AddImageCell.swift @@ -11,16 +11,16 @@ import UIKit final class AddImageCell: UICollectionViewCell { let imageView: UIImageView = { let imageView = UIImageView() - imageView.contentMode = .scaleAspectFit + imageView.contentMode = .scaleAspectFill return imageView }() override init(frame: CGRect) { super.init(frame: frame) - + backgroundColor = .themeBlack - + addSubViews() makeConstraints() } @@ -31,7 +31,12 @@ final class AddImageCell: UICollectionViewCell { } func configure(data: Data) { - imageView.kr.setImage(with: data, placeholder: .empty, width: frame.size.width) + imageView.kr.setImage( + with: data, + placeholder: .empty, + to: frame.size, + scale: FrameResource.openableImageScale + ) } private func addSubViews() {