2014-01-27 8 views
0

나는 iCarousel의 뷰에서 가운데에 놓고 싶은 세 개의 UI 요소를 서로 위에 놓았습니다 (하나의 버튼과 두 개의 텍스트 레이블). 나는 이런 식으로 NSLayoutContraits를 사용해 보았다.iCarousel에서 cellview의 요소를 가운데에 배치하는 방법은 무엇입니까?

[self.backgroundView addConstraint:[NSLayoutConstraint constraintWithItem:self.descriptionLabel 
                   attribute:NSLayoutAttributeCenterX 
                   relatedBy:NSLayoutRelationEqual 
                    toItem:self.backgroundView 
                   attribute:NSLayoutAttributeCenterX 
                   multiplier:1 
                   constant:0]]; 

[self.backgroundView addConstraint:[NSLayoutConstraint constraintWithItem:self.descriptionLabel 
                   attribute:NSLayoutAttributeCenterY 
                   relatedBy:NSLayoutRelationEqual 
                    toItem:self.backgroundView 
                   attribute:NSLayoutAttributeCenterY 
                   multiplier:1 
                   constant:0]]; 

그러나 작동하지 않는다. 어떤 아이디어?

답변

0

이 시도 : 작업을 수행해야합니다

[self.backgroundView setCenter:CGPointMake(xcoord, ycoord)]; 

관련 문제