작업할 때 슈퍼 뷰 밖으로 나가게 되는 콘텐츠들은 선택이 안됨
버튼 같은 경우 해당하는 뷰를 조금만 벗어나도 그 뷰 안에 있는 부분만 눌림
작업하는 뷰 말고 메인 뷰로 아예 빼서 작업하는 뷰와 정렬해서 작업해야 함
viewController.swift
import UIKit
class ViewController: UIViewController {
// main story board 버튼과 연결
@IBAction func showPopup(_ sender: Any) {
let storyBoard = UIStoryboard.init(name: "PopupViewController", bundle: nil)
let popupVC = storyBoard.instantiateViewController(withIdentifier: "PopupVC")
popupVC.modalPresentationStyle = .overCurrentContext
self.present(popupVC, animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
cocoaTouch Class 파일
import UIKit
class PopupViewController: UIViewController {
@IBAction func PopupClose(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
}
@IBAction func DoneAction(_ sender: Any) {
print("Done")
}
}
'Swift' 카테고리의 다른 글
채팅 앱 구조의 이해와 테이블 뷰 활용 (0) | 2021.02.18 |
---|---|
로그인 화면 동적 변환 구조 (0) | 2021.02.17 |
Switch (0) | 2021.02.16 |
커스텀 레이아웃을 스토리 보드와 연동 (0) | 2021.02.15 |
Graph (0) | 2021.02.15 |