|
@@ -33,10 +33,23 @@
|
|
|
_passwordKey = passwordKey;
|
|
_passwordKey = passwordKey;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+- (instancetype)init {
|
|
|
|
|
+ if (self = [super init]) {
|
|
|
|
|
+ self.backgroundColor = [UIColor colorWithRed:0.5 green:0.8 blue:0.6 alpha:1];
|
|
|
|
|
+
|
|
|
|
|
+ self.dotStrokColor = [UIColor redColor];
|
|
|
|
|
+ self.dotFillColor = [UIColor yellowColor];
|
|
|
|
|
+
|
|
|
|
|
+ self.lockStrokColor = [UIColor greenColor];
|
|
|
|
|
+ self.lockHighlightColor = [UIColor purpleColor];
|
|
|
|
|
+ }
|
|
|
|
|
+ return self;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
- (void)viewDidLoad {
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
[super viewDidLoad];
|
|
|
// Do any additional setup after loading the view.
|
|
// Do any additional setup after loading the view.
|
|
|
- self.view.backgroundColor = [UIColor colorWithRed:0.5 green:0.8 blue:0.6 alpha:1];
|
|
|
|
|
|
|
+ self.view.backgroundColor = self.backgroundColor;
|
|
|
|
|
|
|
|
self.index = 0;
|
|
self.index = 0;
|
|
|
self.input = @"";
|
|
self.input = @"";
|
|
@@ -81,7 +94,7 @@
|
|
|
CGFloat y1 = y0 + CGRectGetHeight(self.tipLabel.bounds) + 20; // 间距20,高度20
|
|
CGFloat y1 = y0 + CGRectGetHeight(self.tipLabel.bounds) + 20; // 间距20,高度20
|
|
|
CGFloat x1 = (width - Dot_Width * Password_Length - Dot_Interval * (Password_Length - 1)) / 2;
|
|
CGFloat x1 = (width - Dot_Width * Password_Length - Dot_Interval * (Password_Length - 1)) / 2;
|
|
|
for (int i = 0; i < Password_Length; i++) {
|
|
for (int i = 0; i < Password_Length; i++) {
|
|
|
- JKDotView *dot = [[JKDotView alloc] initWithFrame:CGRectMake(x1 + (Dot_Width + Dot_Interval) * i, y1, Dot_Width, Dot_Width)];
|
|
|
|
|
|
|
+ JKDotView *dot = [[JKDotView alloc] initWithFrame:CGRectMake(x1 + (Dot_Width + Dot_Interval) * i, y1, Dot_Width, Dot_Width) strokColor:self.dotStrokColor fillColor:self.dotFillColor];
|
|
|
|
|
|
|
|
[self.view addSubview:dot];
|
|
[self.view addSubview:dot];
|
|
|
[self.dotArray addObject:dot];
|
|
[self.dotArray addObject:dot];
|
|
@@ -105,6 +118,7 @@
|
|
|
cancelBtn.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
|
|
cancelBtn.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
|
|
|
[cancelBtn setTitle:@"cancel" forState:UIControlStateNormal];
|
|
[cancelBtn setTitle:@"cancel" forState:UIControlStateNormal];
|
|
|
[cancelBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
[cancelBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
|
|
+ [cancelBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
|
|
|
[cancelBtn addTarget:self action:@selector(cancelButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
[cancelBtn addTarget:self action:@selector(cancelButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
[self.view addSubview:cancelBtn];
|
|
[self.view addSubview:cancelBtn];
|
|
|
|
|
|
|
@@ -114,11 +128,14 @@
|
|
|
deleteBtn.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
|
|
deleteBtn.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
|
|
|
[deleteBtn setTitle:@"delete" forState:UIControlStateNormal];
|
|
[deleteBtn setTitle:@"delete" forState:UIControlStateNormal];
|
|
|
[deleteBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
[deleteBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
|
|
+ [deleteBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
|
|
|
[deleteBtn addTarget:self action:@selector(deleteButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
[deleteBtn addTarget:self action:@selector(deleteButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
[self.view addSubview:deleteBtn];
|
|
[self.view addSubview:deleteBtn];
|
|
|
|
|
|
|
|
} else { // 数字
|
|
} else { // 数字
|
|
|
- JKLockButton *btn = [[JKLockButton alloc] initWithFrame:CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width)];
|
|
|
|
|
|
|
+ JKLockButton *btn = [[JKLockButton alloc] initWithFrame:CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width) strokColor:self.lockStrokColor highlightColor:self.lockHighlightColor];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if (i == 1 && j == 3) {
|
|
if (i == 1 && j == 3) {
|
|
|
btn.number = 0;
|
|
btn.number = 0;
|
|
|
} else {
|
|
} else {
|