0
내 UIView 하위 클래스에 아래의 init 메서드를 추가 한 다음이 뷰를 navigationItem의 titleView로 할당하고 있습니다. 빨간색 사각형이 표시됩니다. 즉,이보기가 있음을 의미하지만 노란색 스크롤보기가 표시되지 않습니다. 여기서 내가 뭘 잘못하고 있니?UISavrollView가 UINavigationItem에 표시되지 않습니다.
open class ChatNavBarImagesView : UIView {
private let scrollView = UIScrollView()
public init(navigationController: UINavigationController) {
let height = navigationController.navigationBar.frame.height
super.init(frame: CGRect(x: 0, y: 0, width: 200, height: height))
backgroundColor = UIColor.red
addSubview(scrollView)
scrollView.leadingAnchor.constraint(equalTo: leadingAnchor)
scrollView.trailingAnchor.constraint(equalTo: trailingAnchor)
scrollView.topAnchor.constraint(equalTo: topAnchor)
scrollView.bottomAnchor.constraint(equalTo: bottomAnchor)
scrollView.backgroundColor = UIColor.yellow
scrollView.contentSize = CGSize(width: 200, height: height)
}
의 경계 원하는 뷰의 모든 이미지/스크린 샷과 도움이 될 수 있습니다 실제보기에있는 ScrollView의 프레임을 설정해야합니다. – Adeel