Skip to content

Instantly share code, notes, and snippets.

@hjanuschka
Last active August 29, 2015 14:26
Show Gist options
  • Save hjanuschka/bfd81cab92eed5598d2c to your computer and use it in GitHub Desktop.
Save hjanuschka/bfd81cab92eed5598d2c to your computer and use it in GitHub Desktop.
#import <MWPhotoBrowser/MWCaptionView.h>
#import "MWCaptionView.h"
@interface HJ_MWCaption : MWCaptionView {
MWPhoto *_photo;
}
@property(nonatomic, strong) UIButton * like_button;
@implementation HJ_MWCaption
-(id)initWithPhoto:(MWPhoto *)photo {
_photo = photo;
return [super initWithPhoto:photo];
}
- (CGSize)sizeThatFits:(CGSize)size {
return CGSizeMake(self.bounds.size.width, 100);
}
- (void) likeClicked: (id) sender {
NSLog(@"LIKE CLICKED");
}
- (void)setupCaption {
// self.backgroundColor=[UIColor colorWithRed:255 green:255 blue:255 alpha:0.3];
self.userInteractionEnabled=YES;
}
- (void) layoutSubviews {
if(_like_button != nil) {
return;
}
_like_button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
_like_button.backgroundColor = [UIColor clearColor];
[_like_button setTitle:@"btn" forState:UIControlStateNormal];
_like_button.tag=3;
[self addSubview:_like_button];
[_like_button addTarget:self action:@selector(likeClicked:) forControlEvents:UIControlEventTouchUpInside];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment