Contents

Develop
2022.12.09 15:38

[swift] UIView에서 subview 찾기

Views 5194 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

UIView에서 하위의 subviews 찾아서 배열을 리턴


import UIKit


extension UIView

{

    func findSubViews<T: UIView>(classOf: T.Type) -> [T] {

        return recursiveSubviews.compactMap { $0 as? T }

    }

    

    var recursiveSubviews: [UIView] {

        return subviews + subviews.flatMap { $0.recursiveSubviews }

    }

}






?

List of Articles
No. Category Subject Author Date Views
13 System/OS 개인적으로 쓰고 있는 zshrc 파일 hooni 2022.02.25 3413
12 System/OS 맥에서 포트 확인하고 닫기 (mac) hooni 2022.03.22 7103
11 Develop [ios] Pod 특정 버전 설치하고 사용하기 hooni 2022.05.28 5168
10 Develop [ios] 여러 버전의 Xcode 사용하기 hooni 2022.05.28 4012
9 System/OS [macos] How to Fix ‘You Shut Down Your Computer Because of a Problem’ file hooni 2022.06.01 4528
8 System/OS 네트워크 용어 정리 file hooni 2022.11.20 4607
» Develop [swift] UIView에서 subview 찾기 hooni 2022.12.09 5194
6 Etc 영어. 반드시 외워야 할 문장 패턴 100개 file hooni 2023.06.08 4667
5 Etc 원어민이 매일 쓰는 일상표현 150개 file hooni 2023.09.17 4886
4 System/OS Ubuntu Desktop RDP Setup - 24.04 LTS file hooni 2024.10.16 3418
3 System/OS Brave Browser for Debian, Ubuntu, Mint file hooni 2024.10.23 6988
2 Develop [ios] 배경에 Gradient 적용하기 (CAGradientLayer) file hooni 2024.12.14 3356
Board Pagination Prev 1 ... 90 91 92 93 94 95 96 97 98 99 Next
/ 99