精华内容
下载资源
问答
  • UIImage

    2020-07-25 18:05:38
    UIImageView*imageView=[[UIImageView alloc]init]; imageView.frame=CGRectMake(55, 150, 300, 400); UIImage*image=[UIImage imageNamed:@"535BAB7AF85C3243E4BFB0CD163E1888.jpg

        UIImageView*imageView=[[UIImageView alloc]init];

        

        imageView.frame=CGRectMake(55, 150, 300, 400);

        

        UIImage*image=[UIImage imageNamed:@"535BAB7AF85C3243E4BFB0CD163E1888.jpg"];

        

        imageView.image=image;

        

        [self.view addSubview:imageView];

               
              注:添加的图片直接从桌面拖到.m文件下,复制其地址粘贴到" "中。
    展开全文
  • uiimage

    2010-03-19 11:54:00
    noArtworkImage = [UIImage imageNamed:@"12-6PM.png"];  UIImage *image1 = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image1.jpg" ofType:nil]]; 

     

    noArtworkImage = [UIImage imageNamed:@"12-6PM.png"];

     

    UIImage *image1 = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image1.jpg" ofType:nil]];

     

     

     

    展开全文
  • UIImage-BlurredFrame, UIImage类别,模糊了UIImage的指定框架 UIImage+BlurredFrame是一个UIImage类别,模糊了UIImage的指定框架#Install使用 cocoapods 安装pod 'UIImage+BlurredFrame'#Usage
  • UIImage——特殊UIImage

    千次阅读 2016-08-29 14:31:36
    animated UIImage + (nullable UIImage *)animatedImageNamed:(NSString *)name duration:(NSTimeInterval)duration NS_AVAILABLE_IOS(5_0); // read sequence of files with suffix starting at 0 or 1 + (nullab

    animated

    // animated images. When set as UIImageView.image, animation will play in an infinite loop until removed. Drawing will render the first image
    
    + (nullable UIImage *)animatedImageNamed:(NSString *)name duration:(NSTimeInterval)duration NS_AVAILABLE_IOS(5_0);  // read sequence of files with suffix starting at 0 or 1
    + (nullable UIImage *)animatedResizableImageNamed:(NSString *)name capInsets:(UIEdgeInsets)capInsets duration:(NSTimeInterval)duration NS_AVAILABLE_IOS(5_0); // sequence of files
    + (nullable UIImage *)animatedResizableImageNamed:(NSString *)name capInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode duration:(NSTimeInterval)duration NS_AVAILABLE_IOS(6_0);
    + (nullable UIImage *)animatedImageWithImages:(NSArray<UIImage *> *)images duration:(NSTimeInterval)duration NS_AVAILABLE_IOS(5_0);
    
    @property(nullable, nonatomic,readonly) NSArray<UIImage *> *images   NS_AVAILABLE_IOS(5_0); // default is nil for non-animated images
    @property(nonatomic,readonly) NSTimeInterval duration NS_AVAILABLE_IOS(5_0); // total duration for all frames. default is 0 for non-animated images
    注意:
    • name只是一个base name,UIImage会添加0~1024后缀拼成完整文件名从bundle中load
    • UIImage中的所有UIImage共享同一个size和scale,取images中第一张图片的size和scale
    • images中所有UIImage使用同一capInsets和resizingMode

    right-to-left layout

    - (UIImage *)imageFlippedForRightToLeftLayoutDirection NS_AVAILABLE_IOS(9_0);
    @property (nonatomic, readonly) BOOL flipsForRightToLeftLayoutDirection NS_AVAILABLE_IOS(9_0);
    注意:
    • 只是设置flipsForRightToLeftLayoutDirection属性值为YES,返回的还是原图像
    • 只有当flipsForRightToLeftLayoutDirection为YES而且环境为right-to-left时(比如国家语言环境为阿拉伯,阿拉伯阅读习惯从右向左),UIImage才会以right-to-left layout显示(相当于水平反转)

    render mode

    // Create a version of this image with the specified rendering mode. By default, images have a rendering mode of UIImageRenderingModeAutomatic.
    - (UIImage *)imageWithRenderingMode:(UIImageRenderingMode)renderingMode NS_AVAILABLE_IOS(7_0);
    @property(nonatomic, readonly) UIImageRenderingMode renderingMode NS_AVAILABLE_IOS(7_0);
    /* Images are created with UIImageRenderingModeAutomatic by default. An image with this mode is interpreted as a template image or an original image based on the context in which it is rendered. For example, navigation bars, tab bars, toolbars, and segmented controls automatically treat their foreground images as templates, while image views and web views treat their images as originals. You can use UIImageRenderingModeAlwaysTemplate to force your image to always be rendered as a template or UIImageRenderingModeAlwaysOriginal to force your image to always be rendered as an original.
     */
    typedef NS_ENUM(NSInteger, UIImageRenderingMode) {
        UIImageRenderingModeAutomatic,          // Use the default rendering mode for the context where the image is used
        
        UIImageRenderingModeAlwaysOriginal,     // Always draw the original image, without treating it as a template
        UIImageRenderingModeAlwaysTemplate,     // Always draw the image as a template image, ignoring its color information
    } NS_ENUM_AVAILABLE_IOS(7_0);

    alignment

    // Support for constraint-based layout (auto layout)
    // The alignmentRectInsets of a UIImage are used by UIImageView and other UIView and UIControl
    //  subclasses that take custom images to determine the view's alignment rect insets for
    //  constraint-based layout.
    // The default alignmentRectInsets are UIEdgeInsetsZero.
    - (UIImage *)imageWithAlignmentRectInsets:(UIEdgeInsets)alignmentInsets NS_AVAILABLE_IOS(6_0);
    @property(nonatomic,readonly) UIEdgeInsets alignmentRectInsets NS_AVAILABLE_IOS(6_0);

    resizable

    - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets NS_AVAILABLE_IOS(5_0); // create a resizable version of this image. the interior is tiled when drawn.
    - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode NS_AVAILABLE_IOS(6_0); // the interior is resized according to the resizingMode
    
    @property(nonatomic,readonly) UIEdgeInsets capInsets               NS_AVAILABLE_IOS(5_0);   // default is UIEdgeInsetsZero for non resizable images
    @property(nonatomic,readonly) UIImageResizingMode resizingMode NS_AVAILABLE_IOS(6_0); // default is UIImageResizingModeTile
    /* UIImage will implement the resizing mode the fastest way possible while
     retaining the desired visual appearance.
     Note that if an image's resizable area is one point then UIImageResizingModeTile
     is visually indistinguishable from UIImageResizingModeStretch.
     */
    typedef NS_ENUM(NSInteger, UIImageResizingMode) {
        UIImageResizingModeTile,
        UIImageResizingModeStretch,
    };
    注意:
    • 对单一UIImage应用capInsets和resizingMode

    left cap&top cap

    // use resizableImageWithCapInsets: and capInsets.
    
    - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight __TVOS_PROHIBITED;
    @property(nonatomic,readonly) NSInteger leftCapWidth __TVOS_PROHIBITED;   // default is 0. if non-zero, horiz. stretchable. right cap is calculated as width - leftCapWidth - 1
    @property(nonatomic,readonly) NSInteger topCapHeight __TVOS_PROHIBITED;   // default is 0. if non-zero, vert. stretchable. bottom cap is calculated as height - topCapWidth - 1
    注意:
    • 如果leftCapWidth为0,整个宽度拉升,如果leftCapWidth不为0,一个像素宽度拉伸,topCapHeight类似
    展开全文
  • UIImage渲染

    2019-09-11 17:41:21
    设置UIImage的渲染模式:UIImage.renderingMode 着色(Tint Color)是iOS7界面中的一个.设置UIImage的渲染模式:UIImage.renderingMode重大改变,你可以设置一个UIImage在渲染时是否使用当前视图的Tint Color。UIIma...

    设置UIImage的渲染模式:UIImage.renderingMode

    着色(Tint Color)是iOS7界面中的一个.设置UIImage的渲染模式:UIImage.renderingMode重大改变,你可以设置一个UIImage在渲染时是否使用当前视图的Tint Color。UIImage新增了一个只读属性:renderingMode,对应的还有一个新增方法:imageWithRenderingMode:,它使用UIImageRenderingMode枚举值来设置图片的renderingMode属性。该枚举中包含下列值:

    UIImageRenderingModeAutomatic // 根据图片的使用环境和所处的绘图上下文自动调整渲染模式。
    UIImageRenderingModeAlwaysOriginal // 始终绘制图片原始状态,不使用Tint Color。
    UIImageRenderingModeAlwaysTemplate // 始终根据Tint Color绘制图片,忽略图片的颜色信息。

    renderingMode属性的默认值是UIImageRenderingModeAutomatic,即UIImage是否使用Tint Color取决于它显示的位置。其他情况可以看下面的图例

    以下的代码说明了使用一个既定的rendering模式创建图片是多么简单

    UIImage *img = [UIImage imageNamed:@ "myimage" ]; 
    img = [img imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; 
    
    

    转载于:https://my.oschina.net/u/1590304/blog/475318

    展开全文
  • 关于UIImage

    2019-05-13 15:56:50
    IOS中对图片的处理用到UIImage 类。 UIImage 继承于NSObject 下面介绍一下UIImage中的方法 首先是我们最常用的 通过图片的文件名来获取这个图片 + (UIImage *)imageNamed:(NSString *)name //要注意的是这个...
  • 多个UIImage合并成一个UIImage 创建两个UIImage UIImage *image1 = [UIImage imageNamed:@"iOSDevTip"]; UIImage *image2 = [UIImage imageNamed:@"CodePush"]; 创建UIImage的方法有很多种,我们就简单的...
  • UIImage拉伸

    2019-10-07 23:36:33
    UIImage *img = [UIImage imageNamed:@"write_operation_bg.png"]; UIImage *imgNew = [img stretchableImageWithLeftCapWidth:20 topCapHeight:20]; 宽高拉伸20像素 转载于:...
  • uiimage-from-animated-gif, 加载动画gif的UIImage类别 摘要这个项目在 UIImage 上定义了一个类别 animatedGIF 。 类别定义了两种方法。 这里方法使用 data 中GIF的帧创建动画 UIImage: [UIImage ...
  • 实现UIImage支持截屏功能,源码UIImage-Helpers,该源码功能支持提供三个UIImage的category,而且还可以使UIImage具有支持截屏,另外也可以让图片有模糊的效果,主要是根据颜色生成图片的功能的。 Create a blurred...
  • UIImage-PDF.zip

    2019-09-17 15:22:06
    UIImage-PDF ,UIImage-PDF 是 UIImage 的分类,实现让 UIImage 支持 PDF 文档的显示...
  • UIImage 缩放

    2016-12-27 14:37:47
    UIimage 按比例缩放图片
  • UIImage+ImageEffects

    2019-04-10 15:03:55
    UIImage+ImageEffects 图片模糊处理功能类
  • UIImage缩放

    2016-04-20 16:52:00
    前面讲了截取UIImage指定大小区域,很方便的截取`UIImage`。今天要和大家分享的是`UIImage`的缩放。 两种缩放: 1.缩放到指定大小,也就是指定的`size`. 2.等比缩放。 缩放到指定大小 -(UIImage*)...
  • CMSampleBuffer转UIImage // CMSampleBuffer -> UIImage func sampleBufferToImage(sampleBuffer: CMSampleBuffer) -> UIImage { // 获取CMSampleBuffer的核心视频图像缓冲的媒体数据 let imageBuffer = ...
  • UIImage绘图应用

    2021-03-31 10:41:01
    UIImageView是一个可以显示图片的视图控件,其能够显示图片的本质也是通过绘图来实现的,即,首先加载一张图片(UIImage对象),然后在drawRect:方法中把图片绘制到绘图上下文中,并显示出来。 UIImage类中创建...
  • 绘制UIImage

    2017-04-12 17:35:43
    创建单一颜色的UIImage+(UIImage*)createImageWithColor:(UIColor*) color { CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); UIGraphicsBeginImageContext(rect.size); CGContextRef context = U
  • UIImage转NSData,NSData转UIImage

    千次阅读 2016-03-07 10:52:41
    1 UIImage转NSData UIImage *image = [UIImage imageWithData:data]; 带比例: UIImage *image = [UIImage imageWithData:data scale:1.0]; 1 NSData转UIImage NSData *data; if ...
  • UIimage 剪切

    2016-12-27 14:42:06
    -(UIImage*)getSubImage:(CGRect)rect cgImage:(UIImage*)CGImage { CGImageRef subImageRef = CGImageCreateWithImageInRect(CGImage.CGImage, rect); CGRect smallBounds = CGRectMake(0, 0, CGImageGetWi

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 13,573
精华内容 5,429
关键字:

uiimage