0
我lookedintoalltheseSOanswers但他們都不來解決我所面臨的問題。zoomScale,contentOffset和視網膜
這樣做的缺點是,我的滾動/縮放代碼,我期待它在預視網膜設備的工作原理,但4,4S & 5與iOS 5.x的& 6.x的我的代碼適用於任何價值在1.0以下的縮放我測試過,但當zoomScale精確到1.0或更高時會中斷。
在該點,整個視圖朝向頂部移位/左
此代碼:
- (void) layoutSubviews {
[super layoutSubviews] ;
::NSLog(@"x:%.02f contentOffset (%0.2f:%0.2f)"
, self.zoomScale
, self.contentOffset.x
, self.contentOffset.y) ;
}
產生這對視網膜:(生澀過渡用於zoomScale從低於1.0到大於1.0)
x:0.96 contentOffset (1334.37:622.55)
x:0.98 contentOffset (1371.34:639.45)
x:1.00 contentOffset (226.45:202.26)
x:1.02 contentOffset (227.59:204.19)
x:1.03 contentOffset (228.71:206.10)
產生此非視網膜:(平滑過渡用於從小於1.0到大於1.0的zoomScale)
x:0.95 contentOffset (2211.01:2247.41)
x:0.97 contentOffset (2257.25:2295.54)
x:0.99 contentOffset (2303.52:2343.69)
x:1.03 contentOffset (2403.40:2447.63)
x:1.05 contentOffset (2457.57:2504.00)
任何人? (!仍然是錯誤的)
編輯記錄的滾動/縮放視圖變換產生一致的結果:
非視網膜
scale:0.98 contentOffset(29.11:40.02) transform: [0.978491, 0, 0, 0.978491, 0, 0]
scale:0.99 contentOffset(31.79:43.71) transform: [0.992378, 0, 0, 0.992378, 0, 0]
scale:1.01 contentOffset(35.71:49.11) transform: [1.01268, 0, 0, 1.01268, 0, 0]
scale:1.03 contentOffset(38.40:52.79) transform: [1.02656, 0, 0, 1.02656, 0, 0]
scale:1.04 contentOffset(41.09:56.49) transform: [1.04048, 0, 0, 1.04048, 0, 0]
視網膜
scale:0.98 contentOffset(1377.56:1511.69) transform: [0.984364, 0, 0, 0.984364, 0, 0]
scale:0.99 contentOffset(1392.50:1528.51) transform: [0.993929, 0, 0, 0.993929, 0, 0]
scale:1.02 contentOffset(227.42:300.11) transform: [1.01742, 0, 0, 1.01742, 0, 0]
scale:1.03 contentOffset(228.26:301.48) transform: [1.02922, 0, 0, 1.02922, 0, 0]
scale:1.03 contentOffset(228.48:301.84) transform: [1.03236, 0, 0, 1.03236, 0, 0]