算 保存吧,

-(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;

 

    }

  

  }

posted @ 2013-08-12 10:22  路在脚下,  阅读(206)  评论(0编辑  收藏  举报