转载

[iOS] Cloudy :随机生成蓝天白云背景

Cloudy

[iOS] Cloudy :随机生成蓝天白云背景

Cloudy is a simple UIView subclass that lets you generate random yet beautiful clouds.

Table of Contents

  • Project Details
    • Requirements
    • License
    • Support
    • Sample App
  • Getting Started
    • Installation
    • Setup
  • Documentation

Project Details

Learn more about the Cloudy project, licensing, support etc.

[iOS] Cloudy :随机生成蓝天白云背景

Requirements

  • Requires iOS 7 or later. The sample project is optimized for iOS 9.
  • Requires Automatic Reference Counting (ARC).
  • Optimized for ARM64 Architecture.

License

See theLicense. You are free to make changes and use this in either personal or commercial projects. Attribution is not required, but highly appreciated. A little "Thanks!" (or something to that affect) is always welcome. If you use Cloudy in your app, please let us know!

Support

Join us on gitter if you have any question!

Sample App

The iOS Sample App included with this project demonstrates one way to correctly setup and use Cloudy . It also offers the possibility to customize the view within the app.

Getting Started

It only takes a few simple steps to install and setup Cloudy to your project.

Installation

The easiest way to install Cloudy is to use CocoaPods . To do so, simply add the following line to your Podfile :

pod 'Cloudy'

The other way to install Cloudy , is to drag and drop the Cloudy folder into your Xcode project. When you do so, make sure to check the " Copy items into destination group's folder " box.

Setup

Cloudyis a simple UIView subclass. It can be initialized with Interface Builder, or programatically.

Interface Builder Initialization

1 - Drag a UIView to your UIViewController .

2 - Change the class of the new UIView to Cloudy .

3 - Select the Cloudy and open the Attributes Inspector. Most of the customizable properties can easily be set from the Attributes Inspector. The Sample App demonstrates this capability.

Programmatical Initialization

Here is an example illustrating how to initialize a Cloudy instance programmatically:

let cloudyView = Cloudy(frame: CGRectMake(0.0, 0.0, 200.0, 200.0))
 view.addSubview(Cloudy)

Documentation

All of the methods and properties available for Cloudy are documented below.

cloudsColor

The color of the clouds. Defaults to white.

cloudsShadowColor

The color of the clouds' shadow. Default to darkGrayColor.

cloudsShadowRadius

The radius of the clouds' shadow. Defaults to 1.0.

cloudsShadowOpacity

The opacity of the clouds' shadow. Defaults to 1.0.

cloudsShadowOffset

The offset of the clouds' shadow. Defaults to (0.0, 1.0).

minCloudSizeRatio

The minimum size of the clouds as a ratio of the view's height. From 0.0 to 1.0, 0.0 being 0% of the view's height and 1.0 being 100% of the view's height. Defaults to 0.2.

padding

A padding that will be filled with the color of cloudsColor . The padding will be at the top, or bottom of the view depending on the property orientation . It is expressed as a value between 0.0 and 1.0, 0.0 meaning no padding, and 1.0 that the view will be filled with the padding. Defaults to 0.2.

orientation

The orientation of the clouds. Defaults to Down .

原文  https://github.com/Boris-Em/Cloudy
正文到此结束
Loading...