你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> IOS開發UIImage中stretchableImageWithLeftCapWidth方法的解釋

IOS開發UIImage中stretchableImageWithLeftCapWidth方法的解釋

編輯:關於IOS

- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapWidth;

  Creates and returns a new image object with the specified cap values.     During scaling or resizing of the image, areas covered by a cap are not scaled or resized. Instead, the 1-pixel wide area not covered by the cap in each direction is what is scaled or resized. This technique is often used to create variable-width buttons, which retain the same rounded corners but whose center region grows or shrinks as needed.   上面是官方文檔上得解釋。意思就是用來創建一個內容可拉伸,而邊角不拉伸的圖片,需要兩個參數,第一個是左邊不拉伸區域的寬度,第二個參數是上面不拉伸的高度。那麼接下來的一個像素會被拉伸。例如,leftCapHeight為6,topCapHeight為8。那麼,圖片左邊的6個像素,上邊的8個像素。不會被拉伸,而左邊的第7個像素,上邊的第9個像素這一塊區域將會被拉伸。剩余的部分也不會被拉伸。
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved