我把UIScrollView
填充在主視圖中,並把一個叫它_contentView
UIView
,最後放一些UIView
命名_annotationView
到_contentView.It
可能像下面來描述:爲什麼UIView沒有transform.a和transform.d?
_scrollView
- |
- _contentView
*|
*_annotationView1
*_annotationView2
*……
當我實現了UISrollView
事件「 scrollViewDidZoom
」,和我_contentView.transform.a
和_contentView.transform.d
data.However
,_contentView像這樣子視圖:
- (void)scrollViewDidZoom:(UIScrollView *)scrollView {
NSLog(@"content scale:%f", _contentView.transform.a); //changed every time
NSLog(@"content scale:%f", _contentView.transform.d); //changed every time
for (UIView *view in [_contentView subviews]) {
NSLog(@"x:%f",view.transform.a); //always got 1
NSLog(@"y:%f",view.transform.d); //always got 1
}
}
爲什麼發生?
Thanks.Well,如何在_contentView放大或縮小時修復子視圖的大小?與系統地圖應用的註釋一樣,它們的大小也是固定的。 – Sedgwickz
您可以縮放滾動時的子視圖,以便縮小時縮小子視圖,縮小時縮小。 – sergio
是的,我也這樣做。但是我發現縮放比例可能不一樣。_contentView的子視圖放大小於它的默認值。我只是這樣做:if(_contentView.transform.a> 1 && _contentView.transform.a <= 1.5){CGAffineTransform transform = CGAffineTransformMakeScale(2-_contentView.transform.a,2-_contentView.transform .D); view.transform = transform; } – Sedgwickz