Reputation: 8619
I have a custom UIButton class. I have set up the buttons in the interface builder. I have this code:
#import "FriendButton.h"
@implementation FriendButton
-(id)init {
self = [super init];
NSLog(@"init called");
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPress:)];
[self addGestureRecognizer:longPress];
return self;
}
It isn't being called though, I have set the class type to FriendButton in the interface builder. Is there a different method I need to use? I know that for custom UITableViewCell
s one has to use awakeFromNib
.
Upvotes: 0
Views: 165
Reputation: 31016
From Apple docs:
Objects that conform to the NSCoding protocol (including all subclasses of UIView and UIViewController) are initialized using their initWithCoder: method.
Upvotes: 4