Created
February 25, 2015 08:02
-
-
Save cemolcay/c4fe49ea2c34ce8ddab6 to your computer and use it in GitHub Desktop.
uiview with tap gesture action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
typedef void(^tapAction)(UITapGestureRecognizer *tap); | |
@interface BlockTapView : UIView | |
@property (copy) tapAction blockTapAction; | |
- (instancetype)initWithFrame:(CGRect)frame andAction:(tapAction)action; | |
@end | |
@implementation BlockTapView | |
- (instancetype)initWithFrame:(CGRect)frame andAction:(tapAction)action { | |
if ((self = [super initWithFrame:frame])) { | |
self.blockTapAction = action; | |
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTap:)]; | |
[self addGestureRecognizer:tap]; | |
} | |
return self; | |
} | |
- (void)didTap:(UITapGestureRecognizer *)tap { | |
if (self.blockTapAction) { | |
self.blockTapAction (tap); | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in
DroppySection.m
file, the init method registers a tap gesture to section view calledsectionTapped:
i think button cant trigger because the tap gesutre catches the event first..
you can edit the
sectionTapped:
method for section tap event.