<commit_before># UIImage+Autoresize

[![Version](https://img.shields.io/cocoapods/v/UIImage+Autoresize.svg?style=flat)](http://cocoadocs.org/docsets/UIImage+Autoresize)
[![License](https://img.shields.io/cocoapods/l/UIImage+Autoresize.svg?style=flat)](http://cocoadocs.org/docsets/UIImage+Autoresize)
[![Platform](https://img.shields.io/cocoapods/p/UIImage+Autoresize.svg?style=flat)](http://cocoadocs.org/docsets/UIImage+Autoresize)

## Usage

To run the example project, clone the repo, and run `pod install` from the Example directory first.

The class is also available through this [Gist](https://gist.github.com/kevindelord/fe2e691d06ab745fbb00).

## Documentation

This pod is also documented on [CocoaDocs](http://cocoadocs.org/docsets/UIImage+Autoresize)

## Installation

UIImage+Autoresize is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

    pod "UIImage+Autoresize"

And finally import the header file:

    #import "UIImage+Autoresize.h"

You are now ready to go!

## Requirements

Through the categorised class `UIImage+Autoresize`, a naming convention is applied to deal with different image files.
The following suffixes are expected:

* **none** for 3GS and earlier
* **@2x** for iPhone 4, 4S
* **-568h@2x** for iPhone 5, 5C, 5S
* **-667h@2x** for iPhone 6
* **@3x** for iPhone 6 Plus
* **-512h** for iPad Mini, iPad 2, iPad 1
* **-1024h@2x** for iPad Mini 3, iPad Mini 2, iPad Air, iPad Air 2

When this class is integrated into your project, you have nothing else to do.
You can instantiate an image in your code as you used to like this:

    [UIImage imageNamed: @"background.png" ];

The code will `automatically` load an image corresponding to the current device.
You do NOT need to specify any file extension, if you do the library will ignore itself and only load the file you are asking for.

## Rotating screen: Portrait & Landscape modes

When dealing with multiple interface orientation, an app might need different backgrounds.
One for the portrait mode and another one for the landscape.
With `UIImage+Autoresize` and its naming convention you could even use the same asset name in the code.
The displayed picture will simply change by implementing the folloying methods in your view controller:

On iOS 8 :

    - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
        [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
        self.imageView.image = [UIImage imageNamed:@"bg.png" withTransitionSize:size];
    }

On iOS 7:

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
        [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
        self.imageView.image = [UIImage imageNamed:@"bg.png" ];
    }

### Tips

If you are implementing a multi interface orientation app, it would be good to do the first initialization of your UIImageView in the viewWillAppear.
This way, you should have less problems when the orientation change while a child view controller is presented. When the user pop back the previous background will look as it should.

## Swift

The library works as smooth as it does in Obj-C. Nothing to worry about :)

## TODO:
* Make it work with Storyboard

## Special thanks to
<NAME> for the assets, <EMAIL>

## Author

kevindelord, <EMAIL>

## License

UIImage+Autoresize is available under the MIT license. See the LICENSE file for more info.
<commit_msg>README update<commit_after># UIImage+Autoresize

[![Version](https://img.shields.io/cocoapods/v/UIImage+Autoresize.svg?style=flat)](http://cocoadocs.org/docsets/UIImage+Autoresize)
[![License](https://img.shields.io/cocoapods/l/UIImage+Autoresize.svg?style=flat)](http://cocoadocs.org/docsets/UIImage+Autoresize)
[![Platform](https://img.shields.io/cocoapods/p/UIImage+Autoresize.svg?style=flat)](http://cocoadocs.org/docsets/UIImage+Autoresize)

## Usage

To run the example project, clone the repo, and run `pod install` from the Example directory first.

The class is also available through this [Gist](https://gist.github.com/kevindelord/fe2e691d06ab745fbb00).

## Documentation

This pod is also documented on [CocoaDocs](http://cocoadocs.org/docsets/UIImage+Autoresize)

## Installation

UIImage+Autoresize is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

    pod "UIImage+Autoresize"

And finally import the header file:

    #import "UIImage+Autoresize.h"

You are now ready to go!

## Requirements

Through the categorised class `UIImage+Autoresize`, a naming convention is applied to deal with different image files.
The following suffixes are expected:

* **none** for 3GS and earlier
* **@2x** for iPhone 4, 4S
* **-568h@2x** for iPhone 5, 5C, 5S
* **-667h@2x** for iPhone 6
* **@3x** for iPhone 6 Plus
* **-512h** for iPad Mini, iPad 2, iPad 1
* **-1024h@2x** for iPad Mini 3, iPad Mini 2, iPad Air, iPad Air 2

When this class is integrated into your project, you have nothing else to do.
You can instantiate an image in your code as you used to like this:

    [UIImage imageNamed: @"background.png" ];

The code will `automatically` load an image corresponding to the current device.
You do NOT need to specify any file extension, if you do the library will ignore itself and only load the file you are asking for.

## Rotating screen: Portrait & Landscape modes

When dealing with multiple interface orientation, an app might need different backgrounds.
One for the portrait mode and another one for the landscape.
With `UIImage+Autoresize` and its naming convention you could even use the same asset name in the code.
The displayed picture will simply change by implementing the folloying methods in your view controller:

On iOS 8 :

    - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
        [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
        self.imageView.image = [UIImage imageNamed:@"bg.png" withTransitionSize:size];
    }

On iOS 7:

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
        [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
        self.imageView.image = [UIImage imageNamed:@"bg.png" ];
    }

### Tips

If you are implementing a multi interface orientation app, it would be good to do the first initialization of your UIImageView in the viewWillAppear.
This way, you should have less problems when the orientation change while a child view controller is presented. When the user pop back the previous background will look as it should.

## Swift

The library works with Swift as smooth as it does in Obj-C. Nothing to worry about :)

## TODO:
* Make it work with Storyboard

## Special thanks to
<NAME> for the assets, <EMAIL>

## Author

kevindelord, <EMAIL>

## License

UIImage+Autoresize is available under the MIT license. See the LICENSE file for more info.

{'fraction_non_alphanumeric': 0.09084516945577274, 'fraction_numerical': 0.012375193362396288, 'mean_word_length': 4.877685950413223, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '271220', 'n_tokens_mistral': 2198, 'n_tokens_neox': 2048, 'n_words': 789}