GeoPattern 1.0.5

GeoPattern 1.0.5

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布最后发布2015年9月

Matt Faluotico 维护。



GeoPatternCocoa

使用原生 CoreGraphics 创建漂亮的图案。

这是 Jason Long 的 GeoPattern 的一个移植版本,最初是用 Ruby 编写的,用于使用 SVG。由于 SVG 在 Cocoa 项目中需要外部支持,因此这个版本使用 CoreGraphics。GeoPattern 仅创建一个性感视图。因为它只是一个 UIView,所以可以几乎在任何地方使用。

one

two

three

安装

使用 Cocoapods。

pod 'GeoPattern', ~> 1.0.3

否则,将 GeoPattern 文件夹复制到您的项目,并在您的项目构建中包含安全框架。

使用

您只需导入 GeoPattern.h 即可。

您可以使用 storyboard 创建 GeoPatternView,或者通过初始化一个新的 GeoPatternView。实际上只存在两种方法。

以下是一个基于字符串简单地生成模式的示例

generateWithString: (NSString *) string

使用预设选项基于字符串生成模式。

generateWithString: (NSString *) string andOptions: (NSDictionary*) options

选项

  • kGeoPatternColor: UIColor,确切的背景颜色
  • kGeoPatternBaseColor : UIColor,算法将对其进行编辑。色调和饱和度基于输入字符串。
  • kGeoPatternType - 您想要使用的模式类型。(请参见下文中的列表)

模式类型

这包括原始项目中的所有模式。每个模式都可以通过枚举访问。要使用特定类型的模式生成 GeoPatternView,只需将键添加到选项参数即可。

NSDictionary * options = @{
      kGeoPatternType: [NSNumber numberWithInteger: GeoPatternXes,
      kGeoPatternColor: [UIColor redColor]
    };

[view generateFromString: @"Matthew" withOptions: options;]
  • 八边形 => GeoPatternOctogons
  • 重叠圆圈 => GeoPatternOverlappingcircles
  • 加号 => GeoPatternPlussigns
  • X &=gt; GeoPatternXes
  • 正弦波 => GeoPatternSinewaves
  • 六边形 => GeoPatternHexagons
  • 重叠环形 => GeoPatternOverlappingrings
  • 条格 => GeoPatternPlaid
  • 三角形 => GeoPatternTriangles
  • 正方形 => GeoPatternSquares
  • 同心圆 => GeoPatternConcentriccircles
  • 菱形 => GeoPatternDiamonds
  • 平铺 => GeoPatternTessellation
  • 嵌套正方形 => GeoPatternNestedsquares
  • 马赛克正方形 => GeoPatternMosaicsquares
  • 三角旗 => GeoPatternChevrons