UIViewContentModeScaleToFill ?//不是按照比例放大,把整個(gè)view撐滿,失真,扭曲
UIViewContentModeScaleAspectFit //按照比例放大,保持圖片原有的比例,不會(huì)扭曲,導(dǎo)致view會(huì)有些空白
UIViewContentModeScaleAspectFill // 按比例放大,同時(shí)撐滿整個(gè)view,導(dǎo)致有一部分不會(huì)顯示
UIViewContentModeRedraw // 重繪視圖邊界
UIViewContentModeTop, 視圖頂部對(duì)齊
UIViewContentModeLeft, 視圖左側(cè)對(duì)齊
UIViewContentModeCenter,// contents remain same size. positioned adjusted.? 視圖保持等比縮放
參考文章:http://www.dreamingwish.com/article/coreanimation-programming-guide-e-the-content-layer.html
CALayer與 contentMode對(duì)應(yīng)的屬性叫做contentsGravity,但是它是一個(gè)NSString類型,而不是像對(duì)應(yīng)的UIKit部分,那里面的值是枚舉。contentsGravity可選的常量值有以下一些:
Scaling constant
Description
kCAGravityResize
Resize the content image to completely fill the layer bounds, potentially ignoring the natural aspect of the content. This is the default.
kCAGravityResizeAspect
Resize the content image to scale such that it is displayed as large as possible within the layer bounds, yet still retains its natural aspect.
kCAGravityResizeAspectFill
Resize the content image to scale such that it is displayed filling the layer bounds, yet retaining its natural aspect. This may cause the content to extend outside the layer bounds.