| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- //
- // CustomShapeButton.m
- // JasonDevelop
- //
- // Created by Jason Lee on 3/11/14.
- // Copyright (c) jasondevelop. All rights reserved.
- //
- #import "CustomShapeButton.h"
- @implementation CustomShapeButton
- - (id)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- // Initialization code
- }
- return self;
- }
- - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
- UIBezierPath *path = nil;
- CAShapeLayer *shapeLayer = [[self.layer sublayers] lastObject];
- if ([shapeLayer isKindOfClass:[CAShapeLayer class]]) {
- path = [UIBezierPath bezierPathWithCGPath:shapeLayer.path];
- if (path && [path containsPoint:point]) {
- return self;
- } else {
- return nil;
- }
- }
-
- return nil;
- }
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect
- {
- // Drawing code
- }
- */
- @end
|