본문 바로가기
728x90
반응형

개발/ios (swift)5

scroll up textfield when keyboard show UITextField를 담고 있는 UIScrollView를 만든다. scrollview contain textfield. textField의 키보드가 나타날때 textfield가 가려지지 않도록 textfield를 스크롤 되게한다. when textfield's keyboard show up, scroll up to textfield for textfield not covered. class MainViewController: UIViewController { @IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var textFeid: UITextField! overrid func viewDidLoad() { super.viewDidLoad() No.. 2022. 8. 8.
UITextview Placeholder override func viewDidLoad() { super.viewDidLoad() self.contentTextView.delegate = self self.contentTextView.text = "content".localized() } func textViewDidBeginEditing(_ textView: UITextView) { if textView.textColor == UIColor.lightGray{ textView.text = "" textView.textColor = UIColor.darkGray } else { textView.text = "content".localized() textView.textColor = UIColor.lightGray } } func textView.. 2022. 3. 3.
action when clicked button in cell of collectionView collcetionview의 cell 내부에 있는 UIButton을 눌렀을때 불러온 이미지를 삭제하기 위한 동작에 대한 처리 방법에 대한 글이다. This is about action for delete image when clicked UIButton in cell of UICollectionView. collectionview 용도 : 갤러리에서 불러온 이미지 미리보기 collectionsview's purpose : previvew image selected from gallery Collectionview의 cell cell 내부에는 미리보기용 UIImageview와 이미지 삭제를 위한 UIButton이 존재한다. There is a UIImageView for preview and a UIBut.. 2022. 3. 2.
ios version에 따라 gallery에서 이미지 가지고 오는 방법 language : swift (using storyboard) how to get image from gallery according to ios version. import UIKit import Photos import PhotosUI ios 14부터 PHPicker 사용 ios 14 미만은 UIImagePicker 사용 ios 버전에 따라 두가지 방법을 사용. @IBAction func touchUpAddImage(_ sender: UIButton) { if #available(iOS 14, *) { pickImage() } else { openGallery() } } ios 14이상인 경우 PHPicker 사용 using PHPicker when higher than ios 14 //ios 14.. 2022. 3. 2.
728x90
반응형