Skip to content

superk589/ZKCornerRadiusView

Repository files navigation

ZKCornerRadiusView

Swift4 Version License Platform

A subclass of UIImageView to avoid offscreen-rendering when setting cornerRadius

Installation

CocoaPods:

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate ZKPageViewController into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/superk589/ZKCornerRadiusView.git'
platform :ios, '8.0'
use_frameworks!

target 'YourApp' do
    pod 'ZKCornerRadiusView'
end

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate ZKPageViewController into your Xcode project using Carthage, specify it in your Cartfile:

github "superk589/ZKCornerRadiusView"

Run carthage update to build the framework and drag the built ZKCornerRadiusView.framework into your Xcode project.

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate ZKCornerRadiusView into your project manually.

Usage

let view = ZKCornerRadiusView()
view.zk.backgroundColor = UIColor.yellow
view.zk.borderColor = UIColor.blue
view.zk.borderWidth = 4
view.zk.cornerRadius = 6

// if only want a one color image(with border maybe), use this method manually.
// view.render()

// when set image to the view, all the attributes set above will work.
view.image = UIImage.init(named: imageName)