我正在做一些看起来应该非常简单的事情,但我看到了一些我无法理解的奇怪结果。
我的UIImageView
内部(和UIScrollView
的大小为iOS
,这是它运行的- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return storeImageView;
}
设备的大小。所有这些都在IB中定义。
我有
的委托方法定义viewForZoomingInScrollView
viewForZoomingInScrollView
viewForZoomingInScrollView
scrollViewWillBeginZooming
scrollViewDidZoom
scrollViewDidScroll scrollView contentOffset: NSPoint: {23.675083, 18.840801}
scrollViewDidZoom
scrollViewDidScroll scrollView contentOffset: NSPoint: {44.748684, 35.630745}
… REPEATED MANY TIMES...
scrollViewDidZoom
scrollViewDidScroll scrollView contentOffset: NSPoint: {782.82373, 588.79358}
scrollViewDidZoom
scrollViewDidScroll scrollView contentOffset: NSPoint: {791.22223, 594.99152}
scrollViewDidZoom
scrollViewDidScroll scrollView contentOffset: NSPoint: {791, 595}
scrollViewDidEndZooming scale factor: 2.498063
scrollViewDidEndZooming scrollView frame: NSRect: {{0, 0}, {768, 1024}}
scrollViewDidEndZooming scrollView bounds: NSRect: {{791, 595}, {1024, 768}}
scrollViewDidEndZooming view frame: NSRect: {{0, 0}, {2558.0161, 1918.5121}}
scrollViewDidEndZooming view bounds: NSRect: {{0, 0}, {1024, 768}}
scrollViewDidEndZooming scrollView contentOffset: NSPoint: {791, 595}
scrollViewDidScroll scrollView contentOffset: NSPoint: {-0, -0}
RE-WORK IMAGE AND DRAW NOW
在缩放时,我看到以下名为的委托方法:
scrollViewDidScroll
令人困惑并导致图片移位的是contentOffset
将{{1}}重置为{0,0}的最后{{1}}。看起来我必须无意中留下一个属性集或未设置导致这种行为,但我还没有找到它现在。
任何暗示的建议都将受到高度赞赏。
答案 0 :(得分:2)
解决方案是禁用Autolayout。