• 泡泡聊天框主要方法


       

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

    (NSInteger)topCapHeight 这个函数是UIImage的一个实例函数,它的功能是创建一个内容可拉伸,而边角不拉伸的图片,需要两个参数,第一个是左边不拉伸区域的宽度,第二个参数是上面不拉伸的高度。

    根据设置的宽度和高度,将接下来的一个像素进行左右扩展和上下拉伸。

    注意:可拉伸的范围都是距离leftCapWidth后的1竖排像素,和距离topCapHeight后的1横排像素。

    参数的意义是,如果参数指定10,5。那么,图片左边10个像素,上边5个像素。不会被拉伸,x坐标为11和一个像素会被横向复制,y坐标为6的一个像素会被纵向复制。

    注意:只是对一个像素进行复制到一定宽度。而图像后面的剩余像素也不会被拉伸。

    bubbleImage.image = [[UIImageimageNamed:@"bubbleSomeone.png"] stretchableImageWithLeftCapWidth:21topCapHeight:14];

            bubbleImage.frame = CGRectMake(x - 18, y - 4, self.dataInternal.labelSize.width + 30, self.dataInternal.labelSize.height + 15);

        UIImage *img=[UIImage imageNamed:@"bubbleSelf.png"];
        img=[img stretchableImageWithLeftCapWidth:15 topCapHeight:12];
        UIImageView *imgView=[[UIImageView alloc]initWithImage:img];
        [imgView setFrame:CGRectMake(1010200200)];
        [self. view addSubview:imgView];

  • 相关阅读:
    RTX Server license update
    Dell Raid[转载]
    Dell2950 server OS Installation
    Paragon Partition Manager 9.0 Professional管理磁盘分区
    Upgrade Backup Exec License
    C# 3.0将偷懒进行到底
    hibernate学习笔记
    开发c#插件
    Socket简单通讯
    .NET牛人应该知道些什么(转)?
  • 原文地址:https://www.cnblogs.com/sgdkg/p/3010196.html
Copyright © 2020-2023  润新知