UIImage* img=[UIImage imageNamed:@"name.png"];//原圖 UIEdgeInsets edge=UIEdgeInsetsMake(0, 10, 0,10); //UIImageResizingModeStretch:拉伸模式,通過拉伸UIEdgeInsets... ...
UIImage* img=[UIImage imageNamed:@"name.png"];//原圖 UIEdgeInsets edge=UIEdgeInsetsMake(0, 10, 0,10); //UIImageResizingModeStretch:拉伸模式,通過拉伸UIEdgeInsets指定的矩形區域來填充圖片 //UIImageResizingModeTile:平鋪模式,通過重覆顯示UIEdgeInsets指定的矩形區域來填充圖 img= [img resizableImageWithCapInsets:edge resizingMode:UIImageResizingModeStretch]; imageView.image=img;