0
사용자가 화면에서 탭할 때 이미지 헤더를 전체 크기로 확장하려면 아래 코드를 사용합니다. 이것은 iOS 8에서 완벽하게 작동합니다. 그러나 iOS 7에서는 전혀 작동하지 않습니다. 즉 제약 조건을 변경하면 아무런 효과가 없습니다. 그러나 viewDidLayoutSubviews (초기로드시)에서 동일한 제약 조건을 변경하면 iOS 7에서도 정상적으로 작동합니다. 여기서 무슨 일이 일어날 수 있니? 어떤 도움이라도 대단히 감사 할 것입니다. contentView는 뷰 컨트롤러의 최상위 뷰에 연결됩니다.화면 탭의 제한 변경
-(IBAction) tapScreen:(id)sender {
if (!expanded)
{
if ([self.topSize constant] < correctImageViewHeight+self.topLayoutGuide.length)
[self.topSize setConstant:correctImageViewHeight+self.topLayoutGuide.length];
expanded = YES;
}
else
{
[self.topSize setConstant:self.view.bounds.size.height/2.0f];
expanded = NO;
}
[UIView animateWithDuration:0.4
animations:^{
[self.contentView layoutIfNeeded];
}];
}