[1 문장 초 이해] 그림 스 트 레 칭 기법, 순 코드 쓰기 UIImage 분류 완료

1: 학습 링크:
http://www.open-open.com/lib/view/open1429578290276.html
 
2: 픽 셀 스 트 레 칭:

/**
 *        
 */
+ (instancetype)imageResizableWithImageName:(NSString *)imageName;



--------  



+ (instancetype)imageResizableWithImageName:(NSString *)imageName
{
    UIImage *image = [UIImage imageNamed:imageName];
    
    return [image stretchableImageWithLeftCapWidth:image.size.width * 0.5 topCapHeight:image.size.height * 0.5];
    
}

3: 、
 


/**
 *            、    、       :          (    )
 *      :left:1 right:1  ;     :top:1 bottom:1   :1 1 1 1
 */

+ (instancetype)imageResizableImageWithCapInsets:(NSString *)imageName  UIEdgeInsets:(UIEdgeInsets)UIEdgeInsets;



--------  


+ (instancetype)imageResizableImageWithCapInsets:(NSString *)imageName UIEdgeInsets:(UIEdgeInsets)UIEdgeInsets {
    UIImage *image = [UIImage imageNamed:imageName];
    
    return [image resizableImageWithCapInsets:UIEdgeInsets];
}

4:


            :    

typedef NS_ENUM(NSInteger, UIImageResizingMode) {
    UIImageResizingModeTile,//          
    UIImageResizingModeStretch,//          
};

      ,           ,          :

    UIImage * img= [UIImage imageNamed:@"11.png"];
    img = [img resizableImageWithCapInsets:UIEdgeInsetsMake(1, 1, 1, 1) resizingMode:UIImageResizingModeStretch];


- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode;

 

 

좋은 웹페이지 즐겨찾기