算 保存吧,
-(void)gesture
{
UISwipeGestureRecognizer * leftRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(segmentButtonClick:)];
leftRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
leftRecognizer.cancelsTouchesInView = YES;
UISwipeGestureRecognizer * rightRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(segmentButtonClick:)];
rightRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
// [self.commonTableView addGestureRecognizer:leftRecognizer];
// [self.commonTableView addGestureRecognizer:rightRecognizer];
}
//手势
-(IBAction)segmentButtonClick:(UISwipeGestureRecognizer *)gestureRecognizer
{
//100,作品列表 101,招财账户,102,互动信息
if (currentSegment == 100 && gestureRecognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
self.headerView.frame = CGRectMake(storeHeaderViewframe.origin.x, storeHeaderViewframe.origin.y, storeHeaderViewframe.size.width, storeHeaderViewframe.size.height - 56);
self.tableViewHeaderView.frame = self.headerView.frame;
self.commonTableView.tableHeaderView = self.tableViewHeaderView;
currentSegment = 101;
tableViewResource = MONEYACCOUNT;
UIButton *btn = [[UIButton alloc] init];
btn.tag = currentSegment;
[self.headerView buttonClick:btn];
[self.commonTableViewreloadData];
return;
}else if (currentSegment == 100 && gestureRecognizer.direction == UISwipeGestureRecognizerDirectionRight) {
self.headerView.frame = storeHeaderViewframe;
self.tableViewHeaderView.frame = self.headerView.frame;
self.commonTableView.tableHeaderView = self.tableViewHeaderView;
currentSegment = 102;
tableViewResource = INTERACT;
UIButton *btn = [[UIButton alloc] init];
btn.tag = currentSegment;
[self.headerView buttonClick:btn];
[self.commonTableViewreloadData];
return;
}else if (currentSegment == 101 && gestureRecognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
self.headerView.frame = storeHeaderViewframe;
self.tableViewHeaderView.frame = self.headerView.frame;
self.commonTableView.tableHeaderView = self.tableViewHeaderView;
currentSegment = 102;
tableViewResource = INTERACT;
UIButton *btn = [[UIButton alloc] init];
btn.tag = currentSegment;
[self.headerView buttonClick:btn];
[self.commonTableViewreloadData];
return;
}else if (currentSegment == 101 && gestureRecognizer.direction == UISwipeGestureRecognizerDirectionRight) {
self.headerView.frame = storeHeaderViewframe;
self.tableViewHeaderView.frame = self.headerView.frame;
self.commonTableView.tableHeaderView = self.tableViewHeaderView;
currentSegment = 100;
tableViewResource = WORKS;
UIButton *btn = [[UIButton alloc] init];
btn.tag = currentSegment;
[self.headerView buttonClick:btn];
[self.commonTableViewreloadData];
return;
}else if (currentSegment == 102 && gestureRecognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
self.headerView.frame = storeHeaderViewframe;
self.tableViewHeaderView.frame = self.headerView.frame;
self.commonTableView.tableHeaderView = self.tableViewHeaderView;
currentSegment = 100;
tableViewResource = WORKS;
UIButton *btn = [[UIButton alloc] init];
btn.tag = currentSegment;
[self.headerView buttonClick:btn];
[self.commonTableViewreloadData];
return;
}else if (currentSegment == 102 && gestureRecognizer.direction == UISwipeGestureRecognizerDirectionRight) {
self.headerView.frame = CGRectMake(storeHeaderViewframe.origin.x, storeHeaderViewframe.origin.y, storeHeaderViewframe.size.width, storeHeaderViewframe.size.height - 56);//56 是指作品列表招财账户两者切换时的 header差,这里写死里面了
self.tableViewHeaderView.frame = self.headerView.frame;
self.commonTableView.tableHeaderView = self.tableViewHeaderView;
currentSegment = 101;
tableViewResource = 1;
UIButton *btn = [[UIButton alloc] init];
btn.tag = currentSegment;
[self.headerView buttonClick:btn];
[self.commonTableViewreloadData];
return;
}
}