我在橫向模式下在scrollview上的zoomscale有一些問題。當我將我的iphone放在橫向上時,我希望我的圖像能夠完美縮放。我在我的scrollview上的縮放比例工作正常,當我以縱向模式加載我的圖像時,但是當我把它放到橫向時,它不會改變比例尺,除非我回到tableview並將iphone放在橫向上,然後加載圖像。UIScrollView在橫向和縱向模式下的zoomscale
任何幫助apriciated!
我已經嘗試使用如:
if (UIDeviceOrientationIsLandscape(UIDevice .currentDevice().orientation))
{
scrollView.zoomScale = 0.50
}
if (UIDeviceOrientationIsPortrait(UIDevice .currentDevice().orientation))
{
scrollView.zoomScale = 0.25
}
這是怎麼看起來像當我加載在肖像模式下的圖像:
這是怎麼樣子的時候我將圖片從肖像模式旋轉,同時打開圖片(我希望它如下圖所示):
這是怎麼看起來像當我加載在橫向模式下的圖像:
你聽取方向改變事件嗎?像'UIDevice.currentDevice()。 beginGeneratingDeviceOrientationNotifications()'等 – njuri