Develop
2022.12.09 15:38
[swift] UIView에서 subview 찾기
조회 수 5181 댓글 0
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 }
}
}
-
[ios] Sprite Kit & 사운드 재생시 백그라운드 진입시 앱이 비정상적으로 종료됨
-
[apache2] Redirect HTTP to HTTPS
-
[js] jQuery 셀 병합
-
[macos] How to Fix ‘You Shut Down Your Computer Because of a Problem’
-
[ios] UILabel with two different color text
-
macOS에 node, npm 설치하기 (homebrew)
-
[ios] URL 파라미터 파싱~
-
[php][laravel] 초간단 MacOS에서 Laravel 개발 환경 구축
-
[php][laravel] 라라벨 프로젝트 생성 및 구조
-
네트워크 용어 정리
-
[ios] iOS에서 디바이스 종류 알아오기
-
[ios] SQLite 사용하기(튜토리얼) + 샘플코드