![Masked Icons](https://s3.amazonaws.com/peyton.github.com/MOOMaskedIconView/Why.png)
#Introduction
----------
MOOMaskedIconView is a UIView subclass that uses black-and-white masks to draw icons of different
styles at any size or resolution. It's like Photoshop layer styles, using the same technique as
UITabBar to generate various effects from a single icon mask.
![Tab bar icons](https://s3.amazonaws.com/peyton.github.com/MOOMaskedIconView/Sample-Bar-Cutaway.png)
MOOMaskedIconView displays common image formats and PDFs, the native vector file format of iOS and
OS X. PDFs are best—they're easy to maintain and resolution independent.
#Examples
---------
###Create a green icon from a PNG
MOOMaskedIconView *iconView = [MOOMaskedIconView iconWithResourceNamed:@"icon.png"]
iconView.color = [UIColor greenColor];
[self.view addSubview:iconView];
###Resize a PDF icon and add a reusable gradient trait
MOOStyleTrait *grayGradientTrait = [MOOStyleTrait trait];
grayGradientTrait.gradientColors = [NSArray arrayWithObjects:[UIColor colorWithWhite:0.7f alpha:1.0f],
[UIColor colorWithWhite:0.5f alpha:1.0f], nil];
MOOMaskedIconView *iconView = [MOOMaskedIconView iconWithPDFNamed:@"icon.pdf" size:CGSizeMake(32.0f, 26.0f)];
[iconView mixInTrait:grayGradientTrait];
[self.view addSubview:iconView];
###Add an overlay and a shadow to a red icon
UIImage *overlay = [UIImage imageNamed:@"overlay.png"];
MOOMaskedIconView *iconView = [MOOMaskedIconView iconWithImageNamed:@"icon.png"];
iconView.color = [UIColor redColor];
iconView.overlay = overlay;
iconView.shadowColor = [UIColor darkGrayColor];
iconView.shadowOffset = CGSizeMake(3.0f, 3.0f);
[self.view addSubview:iconView];
###Render a PDF icon into a UIButton
MOOMaskedIconView *iconView = [MOOMaskedIconView iconWithResourceNamed:@"icon.pdf"];
iconView.color = [UIColor magentaColor];
iconView.highlightedColor = [UIColor orangeColor];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:[iconView renderImage] forState:UIControlStateNormal]
[button setImage:[iconView renderHighlightedImage] forState:UIControlStateHighlighted];
[self.view addSubview:button];
For more examples, check out the [Demo Project](https://github.com/peyton/MOOMaskedIconView/tree/master/Demo%20Project).
For the full list of styleable properties, see [MOOMaskedIconViewStyles](http://peytn.com/MOOMaskedIconView/html/Protocols/MOOMaskedIconViewStyles.html).
For information on reusable styles, caching, and other advanced topics, see [*Advanced Use*](https://github.com/peyton/MOOMaskedIconView/wiki/Advanced-Use).
#How to install
-----------
###First: Clone into a submodule
In your project's folder, type:
git submodule add git://github.com/peyton/MOOMaskedIconView.git
A submodule allows your repository to contain a clone of an external
project. If you don't want a submodule, use:
git clone git://github.com/peyton/MOOMaskedIconView.git
###Next: Add classes
Drag `MOOMaskedIconView/` into your Xcode project's file browser.
*Note:* An options dialog will pop up. If you're using MOOMaskedIconView as a submodule,
you should uncheck "Copy items into destination group's folder (if needed)."
###Then: Add Accelerate.framework
![Accelerate.framework process](https://s3.amazonaws.com/peyton.github.com/MOOMaskedIconView/AddAccelerateFramework.png)
With your application's target selected in the navigator, click on the "Build Phases" tab. Under "Link Binary With Libraries," click the "+" button and add `Accelerate.framework`.
###Finally: Import the header
#import "MOOMaskedIconView.h"
###Later: Update to the latest version
`cd` into the MOOMaskedIconView directory and run:
git pull
#Creating image masks
---------
![Image mask process](https://s3.amazonaws.com/peyton.github.com/MOOMaskedIconView/Mask.png)
An image mask is a black-and-white image that clips drawing. Quartz clipping follows three simple rules:
* Black pixels render opaquely.
* White pixels render transparently.
* Gray pixels render with an alpha value of 1 - *source pixel's gray value*.
Mask images may not use an alpha channel, so icons with transparency must be set on a white background. For more information about Quartz image masking, see
the [Quartz 2D Programming Guide](https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_images/dq_images.html%23//apple_ref/doc/uid/TP30001066-CH212-CJBHDDBE).
#Scalable icons with PDFs
---------
MOOMaskedIconView makes it easy to use PDFs as icons, eliminating "\*@2x.\*" files.
Many Apple applications on OS X use PDF icons for resolution independence.
Next to the network, the biggest source of latency on an iPhone is the disk. For small, simple icons the PDF format adds a few KB of overhead over PNG.
Because the iPhone loads data in chunks, in practice the difference in loading time is nothing. For larger icons a PDF of vectors can *save* space.
Some editors need a little massaging to export PDFs suitable for
iOS icons. How-to instructions are [here](https://github.com/peyton/MOOMaskedIconView/wiki/Exporting-PDFs).
#Contributing
--------
Forks, patches, and other suggestions are always welcome and addressed as quickly as possible. Here's a [quick guide](https://github.com/peyton/MOOMaskedIconView/wiki/Contributing) to the process.
没有合适的资源?快使用搜索试试~ 我知道了~
iOS游戏应用源代码——peyton-MOOMaskedIconView.zip
共50个文件
psd:8个
png:8个
pdf:8个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 97 浏览量
2023-07-05
23:22:19
上传
评论
收藏 137KB ZIP 举报
温馨提示
iOS游戏应用源代码——peyton-MOOMaskedIconView.zip
资源推荐
资源详情
资源评论
收起资源包目录
iOS游戏应用源代码——peyton-MOOMaskedIconView.zip (50个子文件)
peyton-MOOMaskedIconView-909acd1
UNLICENSE 2KB
MOOMaskedIconView
MOOCGImageWrapper.h 522B
MOOStyleTrait.m 4KB
MOOCGImageWrapper.m 1KB
AHHelper.h 1KB
MOOMaskedIconView.h 9KB
MOOResourceList.m 5KB
MOOStyleTrait.h 2KB
MOOResourceList.h 3KB
MOOMaskedIconView.m 34KB
Demo Project
MOOMaskedIconView Demo.xcodeproj
project.pbxproj 23KB
MOOMaskedIconView Demo
ViewController.h 204B
AppDelegate.h 326B
AppDelegate.m 3KB
main.m 298B
MOOMaskedIconView Demo-Prefix.pch 347B
Images
Gray-Bar.png 893B
Icons
Location.pdf 5KB
Arrow.pdf 5KB
PSDs
Location.psd 23KB
Rounded Rect.psd 23KB
Arrow.psd 23KB
Beer.psd 49KB
Overlay.psd 50KB
Chat Bubble.psd 23KB
Eye.psd 23KB
Search.psd 23KB
Rounded Rect.pdf 5KB
Chat Bubble.pdf 5KB
Beer.png 2KB
Search.pdf 5KB
Beer.pdf 12KB
Icons to Cache.plist 442B
Overlay.pdf 8KB
Eye.pdf 5KB
Icon.png 167B
[email protected] 266B
Default.png 2KB
ViewController.m 6KB
en.lproj
InfoPlist.strings 45B
MOOMaskedIconView Demo-Info.plist 1KB
Editor Support
Photoshop
CGPDFIcon.joboptions 7KB
Exporting Icons.atn 1KB
README.md 64B
MOOMaskedIconView.podspec 1KB
.gitignore 624B
README.md 5KB
共 50 条
- 1
资源评论
快乐无限出发
- 粉丝: 1135
- 资源: 7274
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- WebCrawler.scr
- 【计算机专业毕业设计】大学生就业信息管理系统设计源码.zip
- YOLO 数据集:8种路面缺陷病害检测【包含划分好的数据集、类别class文件、数据可视化脚本】
- JAVA实现Modbus RTU或Modbus TCPIP案例.zip
- 基于YOLOv8的FPS TPS AI自动锁定源码+使用步骤说明.zip
- JAVA实现Modbus RTU或Modbus TCPIP案例.zip
- 基于yolov8+streamlit的火灾检测部署源码+模型.zip
- 测试aaaaaaabbbbb
- VID20240521070643.mp4
- Android系统原理与开发学习要点详解-培训课件.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功