【发布时间】:2015-02-18 16:49:57
【问题描述】:
我有一个自定义 UIButton 类。我已经在界面生成器中设置了按钮。我有这个代码:
#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;
}
虽然它没有被调用,但我已在界面构建器中将类类型设置为 FriendButton。我需要使用其他方法吗?我知道对于自定义UITableViewCells,必须使用awakeFromNib。
【问题讨论】:
标签: objective-c xcode uibutton