0
- (void)centerScrollViewContents {
CGSize boundsSize = self.scrollView.bounds.size;
CGRect contentsFrame = self.imageView.frame;
if (contentsFrame.size.width < boundsSize.width) {
contentsFrame.origin.x = (boundsSize.width - contentsFrame.size.width)/2.0f;
} else {
contentsFrame.origin.x = 0.0f;
}
if (contentsFrame.size.height < boundsSize.height) {
contentsFrame.origin.y = (boundsSize.height - contentsFrame.size.height)/2.0f;
} else {
contentsFrame.origin.y = 0.0f;
}
self.imageView.frame = contentsFrame;
}
에 이미지 뷰를 배치 할 수 없습니다 나는 viewWillAppear
으로하여 conterScrollViewContents
방법이라고하지만, 이미지 뷰가있는 ScrollView의 중심에 위치하지 않습니다.중심
무엇이 문제입니까?
감사합니다. 나는이 문제를 해결했습니다. imageView의 대리자를 설정하지 않았습니다. – Weizhi