All Projects → lm2343635 → UIImageView-Extension

lm2343635 / UIImageView-Extension

Licence: MIT License
A simple UIImageView category which can set border radius, shadow, circle and rotation for image view.

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to UIImageView-Extension

Xib2storyboard
A tool to convert Xcode .xib to .storyboard files
Stars: ✭ 121 (+245.71%)
Mutual labels:  interface-builder
Ibcustomfonts
IBCustomFonts category allows you to use custom fonts from Interface Builder (IB) when building your iOS apps. Apps using IBCustomFonts category are approved by Apple App Store (check readme.md on latest info). Tested on iOS6 - iOS11.
Stars: ✭ 214 (+511.43%)
Mutual labels:  interface-builder
aka-ios-beacon
The missing binding framework for iOS
Stars: ✭ 13 (-62.86%)
Mutual labels:  interface-builder
Floatinglabeltextfieldswiftui
Floating Label TextField for SwiftUI. FloatingLabelTextFieldSwiftUI
Stars: ✭ 128 (+265.71%)
Mutual labels:  interface-builder
Lgbutton
A fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code.
Stars: ✭ 2,216 (+6231.43%)
Mutual labels:  interface-builder
Simplecheckbox
A simple Checkbox
Stars: ✭ 253 (+622.86%)
Mutual labels:  interface-builder
Everlayout
Reusable, downloadable, up-datable iOS layouts
Stars: ✭ 103 (+194.29%)
Mutual labels:  interface-builder
ios ui recipe showcase
iOSアプリ開発 - UI実装であると嬉しいレシピブック掲載サンプル
Stars: ✭ 54 (+54.29%)
Mutual labels:  interface-builder
Quicklayout
Written in pure Swift, QuickLayout offers a simple and easy way to manage Auto Layout in code.
Stars: ✭ 213 (+508.57%)
Mutual labels:  interface-builder
DPImageView-Letters
An easy, helpful UIImageView extension that generates letter initials as a placeholder for user images, with a custom background color and double border with custom stroke width Completely supports SWIFT 4 and SWIFT 3, written excusively for you.
Stars: ✭ 24 (-31.43%)
Mutual labels:  uiimageview-extension
Instantsearch Android
A library of widgets and helpers to build instant-search applications on Android.
Stars: ✭ 129 (+268.57%)
Mutual labels:  interface-builder
Yapi To Typescript
根据 YApi 或 Swagger 的接口定义生成 TypeScript/JavaScript 的接口类型及其请求函数代码。
Stars: ✭ 161 (+360%)
Mutual labels:  interface-builder
IBLayoutConstraint
📏 Configure constraints for each device in Interface Builder with IBLayoutConstraint.
Stars: ✭ 24 (-31.43%)
Mutual labels:  interface-builder
Iconic
🎨 Auto-generated icon font library for iOS, watchOS and tvOS
Stars: ✭ 1,567 (+4377.14%)
Mutual labels:  interface-builder
CustomSegueDemo
Demonstrates encapsulation of a custom view controller transition into a UIStoryboardSegue subclass
Stars: ✭ 31 (-11.43%)
Mutual labels:  interface-builder
Gskstretchyheaderview
A generic stretchy header for UITableView and UICollectionView
Stars: ✭ 1,624 (+4540%)
Mutual labels:  interface-builder
Lmgaugeview
LMGaugeView is a simple and customizable gauge control for iOS.
Stars: ✭ 224 (+540%)
Mutual labels:  interface-builder
mruby-shelf
Modular webserver interface for mruby
Stars: ✭ 18 (-48.57%)
Mutual labels:  interface-builder
STTextView
📝 STTextView is a light-weight library that adds a placeholder to the UITextView.
Stars: ✭ 36 (+2.86%)
Mutual labels:  interface-builder
DRCircularProgress-iOS
Circular progress view for iOS apps
Stars: ✭ 30 (-14.29%)
Mutual labels:  interface-builder

UIImageView+Extension Supported Platforms Latest pod release Build Status License

A simple UIImageView category with some extension functions.

Features

  • Support Interface Builder.
  • Set border radius for image view.
  • Set shadow for image view.
  • Rotate image view.
  • Set image view to circle.

Installation

CocoaPods

Installing UIImageView+Extension by CocoaPods.

pod 'UIImageView+Extension', '~> 0.2'

Manual Way

  • Add UIImageView+Extension.h and UIImageView+Extension.m to your project.
  • #import "UIImageView+Extension.h" where you want to use the control.
  • These files require ARC.

Usage

  • If you just want to set features in Interface Builder, just do it in Interface Builder, you need not to do anything.

Interface Builder Guide

  • If you want to control your image view in your program, you should import the category header: #import "UIImageView+Extension.h" to your .h or .m file.

API Document

Corner Radius

Setting corner radius is supported in Interface Builder.

// Set corner radius.
_imageView.cornerRadius = 10;

The method setImageCornerRadius:(version 0.2.1 and before) is not recommended to use in this version now.

Shadow

Setting shadow is supported in Interface Builder.

You can also set them in your code. Shadow color and radius are necessary to create a shadow. Shadow will be shown after you set shadow color and radius.

// Change shadow color, offset and radius.
_imageView.shadowColor = [UIColor redColor];
_imageView.shadowRadius = 1.0;
_imageView.shadowXOffset = 1.0;
_imageView.shadowYOffset = 1.0;

Rotate

You can rotate a image view infinitely by the method startRotate:withClockwise:, the first parameter is rotation time per 1 round, the second parameter decides this rotation is clockwise or anticlockwise.

// Init a shadow with color, offset and raduis.
[_imageView startRotate:2 withClockwise:NO];

// Change shadow color, offset and radius.
[_imageView stopRotate];

Blur

Setting blur is supported in Interface Builder. You can set blur style including

  • extraLight (UIBlurEffectStyleExtraLight)
  • light (UIBlurEffectStyleLight)
  • dark (UIBlurEffectStyleDark)
  • regular (UIBlurEffectStyleRegular)
  • prominent (UIBlurEffectStyleProminent)

and blur alpha(0 < alpha <= 1) directly in the Interface Builder. The default style is regular.

// Change blur style, here use the enum UIBlurEffectStyle.
[_imageView changeBlurEffectStyle:UIBlurEffectStyleExtraLight];

// Change blur alpha.
_imageView.blurAlpha = 0.5;

Circle

Setting image view to circle is supported in Interface Builder. You must insure your image view is a square(width = height). We recommend you add Aspect Ratio constraint for your image view.

_imageView.circle = YES;
  • Tip: If you set corner radius and circle at same time, corner radius will be invalid.

Demo App

A demo project contained in this repository shows how to use UIImageView+Extension from a storyboard.

Demo App

Another demo app: I used this extension in my app Rate Assistant, you can download this app from App Store: https://itunes.apple.com/app/murate/id1139573801 to see this demo, it is an open source app, you can get the source code from https://github.com/MuShare/Rate-iOS

Change log

  • version 0.2.6

    • Set userInteractionEnabled in the shadow container to make image view clickale.
    • Give a tip when the image view has no parent view.
  • version 0.2.5.1

    • Fix some issues.
  • version 0.2.5

    • Fix the issue that UIImageView+Extension will affect the display of split line in UISegmentedControl.
  • version 0.2.4

    • Shadow container needs not init manually, so we removed setImageCornerRadius and setShadowWithColor method from interface.
    • Fix the issue that image view(circle attribute ON) is not cirle with auto layout.
  • version 0.2.3

    • Blur image view.
    • Fix the constraint bug for shadow. This version fixed the bug that position and size of a shadow will be wrong if image view has some constraint in the old version.
  • version 0.2.2

    • Set image view to circle.
    • Set corner radius by setter method directly.
  • version 0.2.1

    • Rotate image view infinitely.
  • version 0.2.0

    • Support Interface Builder.
    • Support changing shadow style.
  • version 0.1.0

    • Set corner radius and shadow for UIImageView.

License

UIImageView+Extension is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].