OC

Knowledge OS
登录 注册
全部话题 移民 创业 iOS Mac Objective-C Swift Android 招聘 求职

iOS7下的手势识别注册无效?

jackchen06
jackchen06 发布于 2013年11月07日 | 更新于 2013年11月07日
无人欣赏。

在iOS6上,下面这段代码可以把手势识别注册上,一切工作正常。可是到了iOS7下则不生效,有哪里做的不对吗?

@implementation YFJLeftSwipeDeleteTableView
- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
{
 self = [super initWithFrame:frame style:style];
 if (self) {
 _leftGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swiped:)];
 _leftGestureRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
 _leftGestureRecognizer.delegate = self;
 [self addGestureRecognizer:_leftGestureRecognizer];
 _rightGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swiped:)];
 _rightGestureRecognizer.delegate = self;
 _rightGestureRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
 [self addGestureRecognizer:_rightGestureRecognizer];
 _tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];
 _tapGestureRecognizer.delegate = self;
 // Don't add this yet
 _deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
 _deleteButton.frame = CGRectMake(screenWidth(), 0, kDeleteButtonWidth, kDeleteButtonHeight);
 _deleteButton.backgroundColor = [UIColor redColor];
 _deleteButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
 [_deleteButton setTitle:@"XXXX" forState:UIControlStateNormal];
 [_deleteButton addTarget:self action:@selector(deleteItem:) forControlEvents:UIControlEventTouchUpInside];
 [self addSubview:_deleteButton];
 [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth];
 }
 return self;
}
共2条回复
楼长 ·
jackchen06 回复于 2013年11月07日

@tinyfool 帮帮忙啊

2楼 ·
tinyfool 回复于 2013年11月07日

1楼 @jackchen06 我不知道啊 召唤无敌召唤兽 @sycx 老师

登录 或者 注册

AltStyle によって変換されたページ (->オリジナル) /