-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathENDViewController.m
More file actions
82 lines (61 loc) · 1.78 KB
/
Copy pathENDViewController.m
File metadata and controls
82 lines (61 loc) · 1.78 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// ENDViewController.m
// SmoothLineView
//
// Created by Andreas Kompanez on 05/27/2015.
// Copyright (c) 2014 Andreas Kompanez. All rights reserved.
//
#import "ENDViewController.h"
#import <SmoothLineView/SmoothLineView.h>
#import <PureLayout/PureLayout.h>
#import <CoreMotion/CoreMotion.h>
@interface ENDViewController () <LVSmoothLineViewDelegate>
@property (nonatomic, strong) LVSmoothLineView *smoothLineView;
@property (weak, nonatomic) IBOutlet UIToolbar *toolbar;
@end
@implementation ENDViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.smoothLineView = [[LVSmoothLineView alloc] initForAutoLayout];
self.smoothLineView.delegate = self;
[self.view addSubview:self.smoothLineView];
[self.smoothLineView autoPinEdgesToSuperviewEdgesWithInsets:(ALEdgeInsets){0, 0, self.toolbar.frame.size.height, 0}];
[self pickRedColor:nil];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
[self.smoothLineView undo];
}
- (void)smoothLineViewLongPressed:(LVSmoothLineView *)view
{
UIColor *color = self.smoothLineView.brush.color;
[self.smoothLineView fillWithColor:color];
}
- (IBAction)undo:(id)sender
{
[self.smoothLineView undo];
}
- (IBAction)redo:(id)sender
{
[self.smoothLineView redo];
}
- (IBAction)pickRedColor:(id)sender
{
self.smoothLineView.brush.color = [UIColor redColor];
}
- (IBAction)pickGreenColor:(id)sender
{
self.smoothLineView.brush.color = [UIColor greenColor];
}
- (IBAction)pickBlueColor:(id)sender
{
self.smoothLineView.brush.color = [UIColor blueColor];
}
@end