Skip to content

Latest commit

 

History

History
executable file
·
42 lines (26 loc) · 1.03 KB

README.md

File metadata and controls

executable file
·
42 lines (26 loc) · 1.03 KB

CJImageView

A custom UIImageView that supports contentMode attribute expansion.

If image' size larger than CJImageView' size, contents scaled to fill with fixed aspect and adjust position, some portion of content may be clipped. Otherwise just adjust the position.

CJImageView

Note that self.image or [self image] always return nil. Use [self cjImage]、self.cjImage() instead.

Installation

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

// Objective-C
pod 'CJImageView', '1.0.0'

// Swift
pod 'CJImageViewSwift', '1.0.4'

Usage

  • Objective-C

    #import <CJImageView.h>
    
    self.imageView.image = [UIImage imageNamed:@"xxx"];
    self.imageView.cjContentMode = CJContentModeScaleAspectTop;
  • Swift

    import CJImageView
    
    self.imageView.image = UIImage.init(named: "common_ic_result_win")
    self.imageView.cjContentMode = .scaleAspectTop