-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJSButton.m
More file actions
46 lines (38 loc) · 970 Bytes
/
JSButton.m
File metadata and controls
46 lines (38 loc) · 970 Bytes
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
//
// JSButton.m
// JSButton
//
// Created by Josh Sklar on 4/9/13.
// Copyright (c) 2013 Josh Sklar. All rights reserved.
//
#import "JSButton.h"
#import <QuartzCore/QuartzCore.h>
@interface JSButton()
{
@private
completionBlock tappedButtonBlock;
}
@end
@implementation JSButton
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor whiteColor];
self.layer.cornerRadius = 6.;
self.layer.borderColor = [UIColor blackColor].CGColor;
self.layer.borderWidth = 1.5;
[self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
}
return self;
}
- (void)performBlock:(completionBlock)block forEvents:(UIControlEvents)controlEvents;
{
tappedButtonBlock = block;
[self addTarget:self action:@selector(didTapButton:) forControlEvents:controlEvents];
}
- (void)didTapButton:(id)sender
{
tappedButtonBlock(sender);
}
@end