-
Notifications
You must be signed in to change notification settings - Fork 1
/
DemoImageEditor.m
executable file
·63 lines (46 loc) · 1.42 KB
/
DemoImageEditor.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#import "HFImageEditorViewController+Private.h"
#import "DemoImageEditor.h"
@interface DemoImageEditor ()
@end
@implementation DemoImageEditor
@synthesize saveButton = _saveButton;
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if(self) {
self.cropRect = CGRectMake(0,0,320,320);
self.minimumScale = 0.2;
self.maximumScale = 10;
}
return self;
}
- (void)viewDidUnload
{
[super viewDidUnload];
self.saveButton = nil;
}
- (IBAction)setSquareAction:(id)sender
{
self.cropRect = CGRectMake((self.frameView.frame.size.width-320)/2.0f, (self.frameView.frame.size.height-320)/2.0f, 320, 320);
[self reset:YES];
}
- (IBAction)setLandscapeAction:(id)sender
{
self.cropRect = CGRectMake((self.frameView.frame.size.width-320)/2.0f, (self.frameView.frame.size.height-240)/2.0f, 320, 240);
[self reset:YES];
}
- (IBAction)setLPortraitAction:(id)sender
{
self.cropRect = CGRectMake((self.frameView.frame.size.width-240)/2.0f, (self.frameView.frame.size.height-320)/2.0f, 240, 320);
[self reset:YES];
}
#pragma mark Hooks
- (void)startTransformHook
{
self.saveButton.tintColor = [UIColor colorWithRed:0 green:49/255.0f blue:98/255.0f alpha:1];
}
- (void)endTransformHook
{
self.saveButton.tintColor = [UIColor colorWithRed:0 green:128/255.0f blue:1 alpha:1];
}
@end