내 MapKit 콜 아웃보기가 너무 작아서 표시해야하는 모든 항목을 표시하지 않는 이유는 무엇입니까?

잭 베르 스트 렘

솔루션 작동하도록 제약 조건을 적용해야했습니다.

let widthConstraint = NSLayoutConstraint(item: customCalloutView, attribute: .Width, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1, constant: 200)
        customCalloutView.addConstraint(widthConstraint)
        let heightConstraint = NSLayoutConstraint(item: customCalloutView, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1, constant: 200)
        customCalloutView.addConstraint(heightConstraint)

MapKit 통합을 수행하고 마침내 내 앱이 내 사용자 정의 콜 아웃보기를 표시하도록했습니다. 그러나 어떤 이유로 인해 크기가 작아서 표시해야하는 모든 항목을 표시하지 않습니다 ... 제목은 제대로 표시되지만 사용자 정의 "detailCalloutAccessoryView"(즉, 몇 개의 레이블, 이미지보기 및 단추가있는 사용자 정의 .xib 파일에서로드 됨)이 올바르게 표시되지 않습니다.

내 말은 다음과 같습니다.

문제의 스크린 샷

내 detailCalloutAccessoryView가 잘리는 이유는 무엇입니까? 다음과 같이 표시되어야합니다.

.xib 파일

어떤 아이디어? 이 문제를 어떻게 해결할 수 있습니까?

잭 베르 스트 렘

해결책 나는 그것이 작동하도록 제약을 적용해야만했다. 이 코드는 내 viewForAnnotation 메서드에 배치되었습니다.

let widthConstraint = NSLayoutConstraint(item: customCalloutView, attribute: .Width, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1, constant: 200)
        customCalloutView.addConstraint(widthConstraint)
        let heightConstraint = NSLayoutConstraint(item: customCalloutView, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1, constant: 200)
        customCalloutView.addConstraint(heightConstraint)

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관