Autolayout에서 화면 중앙에 뷰를 배치하는 방법
2271 단어 StoryboardiOS아이폰XcodeAutoLayout
개요
화면 중앙에 피커 뷰, 그 설명문을 그 위에 표시하고 싶을 때 등에 편리한 레시피입니다.
이런 상태로 하고 싶은
세로 방향일 때 중심이 된다

옆으로 향할 때도 중심이 되고 있다

조리법
Use Auto layout 확인

사용할 라벨


가키 케코 라벨은 세로는 고정, 가로는 가변으로하고 싶기 때문에,
・종단까지의 여백 10pt
・라벨 자체의 세로 135pt
으로 추가

여기서는 Vertical Center in Container를 선택하여
화면 상하의 중앙에 배치시킬 수 있습니다

다음 설정
・종단까지의 여백 10pt
・카키쿠케코 라벨까지의 거리 10pt
・라벨 자체의 세로 20pt

Warning 대응
Actual을 긍정하고 싶기 때문에 Update Constraints를 선택


Reference
이 문제에 관하여(Autolayout에서 화면 중앙에 뷰를 배치하는 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ssqiita/items/6940e4342c2143f39be7텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)