打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
iOS 图片平铺 drawAsPatternInRect

    UIImage *imgQuestionBgBottom = [UIImage imageNamed:@"profile_arrow.png"];

    UIImage *imgQuestionBgMiddle = [UIImage imageNamed:@"profile_arrow1.png"];    

    float tileHeight = 8;

    float tileWidth = 9;

    float imageHeight = tileHeight*5;

    UIGraphicsBeginImageContext(CGSizeMake(tileWidth, imageHeight+imgQuestionBgBottom.size.height));

    [imgQuestionBgMiddle drawAsPatternInRect:CGRectMake(0, 0, tileWidth, imageHeight)];

    [imgQuestionBgBottom drawInRect:CGRectMake(0, imageHeight, imgQuestionBgBottom.size.width, imgQuestionBgBottom.size.height)];

    UIImage* imgBg = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    

    self.leftTopImageView.image = imgBg;

    self.leftTopImageView.frame = CGRectMake(0, 0, imgBg.size.width, imgBg.size.height);


实例:
下面分别是imgQuestionBgMiddle,imgQuestionBgBottom组成imgBg。
 
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
【iOS学习】----UISegmentedControl
使用GPUImage实现iOS 7的模糊效果
iOS中使用ZBar扫描二维码自定义扫描界面
关于自定义AlertView背景的方法收集
swift 从相册里取图片并Post传到服务器上
03 微博 解决iOS7与iOS6图片适配的方法
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服