Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 |
Tags
- iOS Target
- Ribs
- RxCocoa
- ios
- Concurrent
- 대머리깃허브
- in-out
- rib
- swiftdocs
- memory safety
- Dispatch.main.sync
- 클린아키텍쳐
- UICoordinateSpace
- Large File Storage
- Github file size
- RIBs Tutorial
- windowScene
- 메모리 접근 충돌
- SWIFT
- Automatically manage signing
- RxSwift
- Dependency Rule
- coordinateSpace
- App Signing
- Git Large File Storage
- 로버트마틴형
- conflicting access to memory
- iOS 버전 점유율
- 잡초가득블로그
- Apple Certificate
Archives
- Today
- Total
빙수왕의 개발일지
tabBarItem.value(forkey: "view")가 nil일 때 본문
문제상황:
UITabBar을 커스텀해서 사용하는데, 그 안에 UITabBarItem을 코드로 추가했다.
UITabBarItem에 로띠를 추가하기 위해 value(forkey: "view")를 찾아서 subView로 로띠를 넣어주는데 value(forkey: "view") << 이게 자꾸 nil이 나왔다.
해결방안:
UITabBar에 append를 먼저 해줬어야 했다.
let tabBarItem = UITabBarItem(title: nil, image: image, tag: index)
self.items?.append(tabBarItem) // 여기 꼭 먼저 써줘야 아래서 nil이 안나온다.
guard let tabBarButton = tabBarItem.value(forkey: "view") as? UIView else { return }
'개발 > iOS' 카테고리의 다른 글
| autolayout 제약오류 시 체크할 것 (0) | 2021.05.18 |
|---|---|
| 주석 다는법 (0) | 2021.05.07 |
| Api에서 받아온 data를 예쁘게 출력하기 (0) | 2021.03.20 |
| struct의 variable들을 array처럼 쓸 수는 없을까? (0) | 2021.03.03 |
| loaded the \"FirstViewController\" nib but the view outlet was not set (0) | 2021.03.01 |