深入理解iOS API系列(二)UIImage的resizableImageWithCapInsets:resizingMode:
最近在看《programming iOS8》,看到第二章的“可調整大小的images”。實現這個效果的方法我們並不陌生,可以參看MJ的部落格 。當然我們要討論的不是API的變動,我們更關注UIImageResizingMode的影響。它有兩個列舉量UIImageResizingModeTile和 UIImageResizingModeStretch。我覺得作者對於這個變數的效果的描述還是非常到位的。
UIImageResizingModeTile
The interior rectangle of the inset area is tiled (repeated) in the interior; each edgeis formed by tiling the corresponding edge rectangle outside the inset area. The fourcorner rectangles outside the inset area are drawn unchanged.
UIImageResizingModeStretch
The interior rectangle of the inset area is stretchedonceto fill the interior; each edgeis formed by stretching the corresponding edge rectangle outside the inset areaonce. The four corner rectangles outside the inset area are drawn unchanged.
對於Tile方式的,我們可以把一張圖分解為3部分,一個是inset確定的內部區域,一個是四個端帽,還有一個是剩餘部分,剩餘部分剛好是與
現在再來看看http://www.cnblogs.com/heyonggang/archive/2013/12/19/3482733.html,你應該能夠理解作者的意思了。其他的博文:
http://www.cnblogs.com/zhangqifeng/p/4004433.html
http://blog.sina.com.cn/s/blog_884e78b2010150b3.html
http://duchengjiu.iteye.com/blog/1901288
嚴重參考:
http://www.th7.cn/Program/IOS/201405/203735.shtml