chaneeii / iOS-Study-Log

✨ iOS에 대해 공부한 것들을 기록합니다 ✨
18 stars 0 forks source link

UIView 의 우선순위 #48

Open chaneeii opened 2 years ago

chaneeii commented 2 years ago

https://stackoverflow.com/questions/38780743/how-can-i-bring-a-view-in-front-of-another-view-in-swift

chaneeii commented 2 years ago

스크린샷 2022-10-17 오전 1 33 57

chaneeii commented 2 years ago

https://zeddios.tistory.com/m/832

요렇게 만들고 싶은데,

스크린샷 2022-10-17 오후 5 10 46

이렇게 되었다..!

스크린샷 2022-10-17 오후 5 11 59

해결방법은!!

contentview를 기준으로 sendSubviewToBack 을 해주었다!

    func createLayout() {
        contentView.addSubviews([imageView, emojiView, menuLabel, dateLabel])

        contentView.sendSubviewToBack(emojiView)
        emojiView.snp.makeConstraints {
            $0.top.equalToSuperview()
            $0.leading.equalToSuperview().offset(9)
            $0.width.height.equalTo(30)
        }

        imageView.snp.makeConstraints {
            $0.top.equalToSuperview().inset(15)
            $0.leading.trailing.equalToSuperview()
            $0.width.height.equalTo(167)
        }