https://github.com/lele8446/cjimageview
A custom UIImageView that supports contentMode attribute expansion.
https://github.com/lele8446/cjimageview
contentmode imageview ios objective-c swift uikit
Last synced: 3 months ago
JSON representation
A custom UIImageView that supports contentMode attribute expansion.
- Host: GitHub
- URL: https://github.com/lele8446/cjimageview
- Owner: lele8446
- License: mit
- Created: 2016-01-12T14:48:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-09-18T09:59:39.000Z (almost 5 years ago)
- Last Synced: 2025-03-13T15:16:41.718Z (over 1 year ago)
- Topics: contentmode, imageview, ios, objective-c, swift, uikit
- Language: Objective-C
- Homepage:
- Size: 2.36 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.

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:
```sh
// Objective-C
pod 'CJImageView', '1.0.0'
// Swift
pod 'CJImageViewSwift', '1.0.4'
```
### Usage
* Objective-C
```objective-c
#import
self.imageView.image = [UIImage imageNamed:@"xxx"];
self.imageView.cjContentMode = CJContentModeScaleAspectTop;
```
* Swift
```swift
import CJImageView
self.imageView.image = UIImage.init(named: "common_ic_result_win")
self.imageView.cjContentMode = .scaleAspectTop
```