美文网首页
iOS 图标设计工具

iOS 图标设计工具

作者: 怪气 | 来源:发表于2018-10-05 12:52 被阅读111次

    APP名称:图标设计工具

    运行环境:iOS 9 以及以上系统

    开发工具:xcode

    简介:

    一款APP图标生成工具,免去切图烦恼。内置2000多种图标素材,常用切图素材应有尽有。

    自定义图标颜色、大小。

    丰富的emoji表情。

    新增QQ表情包,支持一键导出

    功能:

    【支持自定义图标素材】

    【一键搜索方便查找】

    【emoji、特殊字符一个不少】

    【表情转图标、文字转图标尽情玩转】

    【UI、开发人员的专属切图利器】

    APP预览:

    核心代码:

    import UIKit

    extension UIImage {

        funcnormalizedImage() ->UIImage{

            ifself.imageOrientation == UIImageOrientation.up {

                returnself;

            }else{

                UIGraphicsBeginImageContextWithOptions(self.size,false,self.scale);

                self.draw(in: CGRect.init(x:0, y:0, width:self.size.width, height:self.size.height));

                letnormalizedImage:(UIImage)! = UIGraphicsGetImageFromCurrentImageContext()

                UIGraphicsEndImageContext()

                returnnormalizedImage;

            }

        }

        staticfuncimage(identifier:String,backgroundColor:UIColor,iconColor:UIColor,fontSize:CGFloat) ->UIImage{

            //// Abstracted Attributes

            vartextContent:String! = identifier;

            if(textContent.hasPrefix("fa-")) {

                textContent = NSString.fontAwesomeStringOfIdentifier(identifier: identifier)

            }

            letfont:UIFont! = UIFont.init(name:"FontAwesome", size: fontSize)

            letstyle:NSMutableParagraphStyle! = NSMutableParagraphStyle.default.mutableCopy()as!NSMutableParagraphStyle

            style.alignment = NSTextAlignment.center;

            letattributes = [NSAttributedStringKey.font : font,NSAttributedStringKey.foregroundColor:iconColor,NSAttributedStringKey.backgroundColor:backgroundColor,NSAttributedStringKey.paragraphStyle:style]as[NSAttributedStringKey:Any]

            //// Content Edge Insets

            varsize:CGSize! = (textContent!as!NSString).size(withAttributes: attributes)

            size = CGSize(width: size.width *1.0, height: size.height *1.05)

            lettextRect:CGRect! = CGRect(x:0, y:0, width: size.width, height: size.height)

            letorign = CGPoint(x: size.width *0.05, y: size.height *0.025)

            UIGraphicsBeginImageContextWithOptions(size,false,0.0);

            //// Rectangle Drawing

            letpath:UIBezierPath! = UIBezierPath.init(rect: textRect)

            backgroundColor.setFill()

            path.fill()

            (textContent!asNSString).draw(at: orign, withAttributes: attributes)

            // Text Drawing

            //Image returns

            letimage = UIGraphicsGetImageFromCurrentImageContext();

            UIGraphicsEndImageContext();

            returnimage!

        }

        staticfuncimage(identifier:String,backgroundColor:UIColor,iconColor:UIColor,iconSize:CGFloat,canvasSize:CGSize) ->UIImage{

            //// Abstracted Attributes

            vartextContent:String! = identifier;

            if(textContent.hasPrefix("fa-")) {

                textContent = NSString.fontAwesomeStringOfIdentifier(identifier: identifier)

            }

            letfont:UIFont! = UIFont.init(name:"FontAwesome", size: iconSize)

            letstyle:NSMutableParagraphStyle! = NSMutableParagraphStyle.default.mutableCopy()as!NSMutableParagraphStyle

            style.alignment = NSTextAlignment.center;

            letattributes = [NSAttributedStringKey.font : font,NSAttributedStringKey.foregroundColor:iconColor,NSAttributedStringKey.backgroundColor:backgroundColor,NSAttributedStringKey.paragraphStyle:style]as[NSAttributedStringKey:Any]

            //// Content Edge Insets

            varsize:CGSize! = (textContent!as!NSString).size(withAttributes: attributes)

            lettextRect:CGRect! = CGRect(x:0, y:0, width: canvasSize.width, height: canvasSize.height)

            letorign = CGPoint(x: (canvasSize.width - size.width) *0.5, y: (canvasSize.height - size.height) *0.5)

    //        let orign = CGPoint(x: (canvasSize.width - size.width) * 0, y: (canvasSize.height - size.height) * 0)

            UIGraphicsBeginImageContextWithOptions(canvasSize,false,0.0);

            //// Rectangle Drawing

            letpath:UIBezierPath! = UIBezierPath.init(rect: textRect)

            backgroundColor.setFill()

            path.fill()

            (textContent!asNSString).draw(at: orign, withAttributes: attributes)

            // Text Drawing

            //Image returns

            letimage = UIGraphicsGetImageFromCurrentImageContext();

            UIGraphicsEndImageContext();

            returnimage!

        }

    }

    下载地址:https://itunes.apple.com/cn/app/图标设计工具/id1417167589?mt=8

    二维码下载:

    相关文章

      网友评论

          本文标题:iOS 图标设计工具

          本文链接:https://www.haomeiwen.com/subject/eyhqaftx.html