Simple pinch-zoom category for UILabel.
This clearly inspired by UITextView-PinchZoom who is the real author of the category. I just made some adaptions to have it working on UILabel and a sample program to show how it can be implemented using storyboard
Install with CocoaPods by adding the following to your Podfile:
platform :ios, '4.3'
pod 'UILabel+PinchZoom', '~> 0.0.2'
Note: We follow http://semver.org for versioning the public API.
Or copy the UILabel-PinchZoom/
directory from this repo into your project.
This is how you can create it:
#import "UILabel+PinchZoom.h"
//...
UILabel *label = [[UILabel alloc] initWithFrame:self.view.frame];
[self.view addSubview:label];
label.zoomEnabled = YES;
label.minFontSize = 10;
label.maxFontSize = 40;
Usually you'll nest it into a UIScrollview which will force you to do something like this in most cases
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
[self.commentLabel setNeedsLayout];
}
Have a look at the Example Project for more details
#Contributions
...are really welcome. If you have an idea just fork the library change it and if its useful for others and not affecting the functionality of the library for other users I'll insert it
Source code of this project is available under the standard MIT license. Please see the license file.